﻿Imports Microsoft.DirectX.Direct3D
Imports Microsoft.DirectX
Imports Commander_Wars.Spieletools
Public Enum Richtungen
    Oben
    Rechts
    Unten
    Links
End Enum
Public MustInherit Class ObjektEinheit
    Implements ICloneable
    Public Enum AnimationSets3D
        Idle
        Walk
        Wait
        Fight
    End Enum

    Public Const Unit_Space As Integer = 1
    Public Const Unit_Heavy_Price As Integer = 10000
#Region "Variablen"
    Enum AISetting
        ''' <summary>
        ''' Use normal AI moving
        ''' </summary>
        ''' <remarks></remarks>
        Standard
        ''' <summary>
        ''' Attack, Attack all out
        ''' </summary>
        ''' <remarks></remarks>
        Aggresiv
        ''' <summary>
        ''' Defend, Defend never loose this Unit.
        ''' </summary>
        ''' <remarks></remarks>
        Deffensiv
        ''' <summary>
        ''' Do nothing only Attack if can...
        ''' </summary>
        ''' <remarks></remarks>
        Halten
    End Enum

    Private EinheitenIDD As String
    Public Property EinheitenID() As String
        Get
            Return EinheitenIDD
        End Get
        Set(ByVal value As String)
            EinheitenIDD = value
        End Set
    End Property
    Private Besitzer As Integer
    Public Property Spieler() As Integer
        Get
            Return Besitzer
        End Get
        Set(ByVal value As Integer)
            Besitzer = value
        End Set
    End Property
    Private Bewegt As Boolean
    Public Property HatsichBewegt() As Boolean
        Get
            Return Bewegt
        End Get
        Set(ByVal value As Boolean)
            Bewegt = value
            If DataSettings.draw3D Then
                'wenn das sich veraendert hat, dann aktuallisieren wir am besten gleichmal das 3D
                AnimationAktuallisieren()
            End If
        End Set
    End Property
    'ein paar sachen fuers 3D
    Public AnimPos As Double
    Public AnimPeriode As Double
    ''' <summary>
    ''' Die Anzahl Frames, die gewartet wird, bevor die Animation von vorne beginnt. -1 fuer keinen Neudurchgang.
    ''' </summary>
    ''' <remarks></remarks>
    Public AnimAuszeit As Integer = -1
    Public Rotation As Single = Math.PI / 2
    Public AnimSetName As String = AnimationSets3D.Wait.ToString
    Public AnimSetNaechsterName As String = AnimationSets3D.Wait.ToString
    ''' <summary>
    ''' Tells the AI how to use Units.
    ''' </summary>
    ''' <remarks></remarks>
    Public AIUse As AISetting = AISetting.Standard
    Enum Stufe
        Soldat
        Leutnant
        Offizier
        General
        Veteran
        KO
    End Enum
    Public TruppenStufe As Stufe = Stufe.Soldat
    Public Property EinheitenStufe() As Stufe
        Get
            Return TruppenStufe
        End Get
        Set(ByVal value As Stufe)
            If TruppenStufe <> Stufe.KO Then
                If value > 0 Then
                    If TruppenStufe < Stufe.Veteran Then
                        TruppenStufe += 1
                    End If
                    Select Case DataSettings.CommanderWarsGameModus
                        Case CommanderWarsGameModi.AdvanceWarsDC
                            If TruppenStufe = Stufe.General Then TruppenStufe = Stufe.Veteran
                    End Select
                Else
                    TruppenStufe = Stufe.Soldat
                End If
            End If
        End Set
    End Property
    Public Leben As Single
    Public Sub IncreaseLeben(ByVal PLusLeben As Single)
        Leben += PLusLeben
        If Leben > 100 Then Leben = 100
        If Leben < 0 Then Leben = 1
    End Sub
    Public Property KP() As Single
        Get
            Return Leben
        End Get
        Set(ByVal value As Single)
            Leben += value
            If Leben > 100 Then Leben = 100
            If Leben <= 0 Then Tod = True
        End Set
    End Property
    Public Function getKP() As Integer
        Dim I As Integer = Math.DivRem(CInt(Leben), 10, 0)
        If I < 0 Then
            Return 0
        End If
        If Leben - I * 10 > 0 Then
            I += 1
        End If
        Return I
    End Function
    Public Sub SetKP(ByVal KP As Integer)
        Leben = KP * 10
    End Sub
    Public Sprit As Integer
    Public Property Treibstoff() As Integer
        Get
            If SpritMax < 0 Then
                Return -1
            Else
                Return Sprit
            End If
        End Get
        Set(ByVal value As Integer)
            If SpritMax < 0 Then Exit Property
            If value < 0 Then
                Sprit += value * GetTreibstoffMultiplikator()
            Else
                Sprit += value
            End If
            If Sprit < 0 Then Sprit = 0
            If Sprit > SpritMax Then Sprit = SpritMax
        End Set
    End Property
    Protected Muni As Integer
    Public Property Munition() As Integer
        Get
            Return Muni
        End Get
        Set(ByVal value As Integer)
            If MunitionMax < 0 Then Exit Property
            Muni += value
            If Muni < 0 Then Muni = 0
            If Muni > MunitionMax Then Muni = MunitionMax
        End Set
    End Property
    Public Property Einheitenname() As String
        Get
            Return Name
        End Get
        Set(ByVal value As String)
            Name = value
        End Set
    End Property

    Private Besetzung As Boolean = False
    Public Property Besetzen() As Boolean
        Get
            Return Besetzung
        End Get
        Set(ByVal value As Boolean)
            Besetzung = value
        End Set
    End Property


    ''' <summary>
    ''' Gibt an ob die Einheit untergetaucht ist.
    ''' </summary>
    ''' <remarks></remarks>
    Private Tarnung As Boolean = False


    ''' <summary>
    ''' Gibt zurueck ob die Einheit untergetaucht ist.
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function GetTarnung() As Boolean
        Return Tarnung
    End Function
    Public Ladung() As ObjektEinheit = {}



    'Diese Werte koennen fuer einen Zug veraendert werden
    ''' <summary>
    ''' X=ATK und Y =Def
    ''' </summary>
    ''' <remarks></remarks>
    Public ATKDEFBoost As Point = New Point(0, 0)
    Public KannReapariertWerden As Boolean = True
    Public Bewegungsbonus As Integer = 0
    Public RadioaktiveVerseuchung As Integer = 0
    Public Feldtarnung As Boolean = False
    Public BesetzungsBonus As Integer = 0
    Public ReichweitenBonus As Integer = 0
    Public SichtBonus As Integer = 0
    Public TreibstoffSenkung As Integer = 0

    Public AnimController As AnimationController
    Public X, Y, Battlemap As Integer
    Public Tod As Boolean = False
    Public SpritMax As Integer
    ''' <summary>
    ''' Die BildID von Infanteristen
    ''' </summary>
    ''' <remarks></remarks>
    Public Shared INFID As Integer = -1
    Public Treibeverbrauch As Integer
    Public ReadOnly Property Treibstoffverbrauch() As Integer
        Get
            Return Treibeverbrauch
        End Get
    End Property
    Public MunitionMax As Integer
    Private Name As String
    Private BildIDD As Integer
    Public Property BildID() As Integer
        Get
            Return BildIDD
        End Get
        Set(ByVal value As Integer)
            BildIDD = value
        End Set
    End Property
    Private Frames As Integer
    Public Property Frame() As Integer
        Get
            Return Frames
        End Get
        Set(ByVal value As Integer)
            Frames += 1
            If Frames > 3 Then
                Frames = 0
            End If
        End Set
    End Property
    Private Bewpunkte As Integer
    Public Property Bewegungspunkte() As Integer
        Get
            If Bewpunkte + Bewegungsbonus < 0 Then
                Return 0
            Else
                Return Bewpunkte + Bewegungsbonus
            End If
        End Get
        Set(ByVal value As Integer)
            Bewpunkte = value
        End Set
    End Property
    Private Bewegungsarte As String
    Public Property Bewegungsart() As String
        Get
            Dim S As ObjektSpieler = GetSpieler()
            If S IsNot Nothing Then
                If S.KOS IsNot Nothing Then
                    If S.KOS(0) IsNot Nothing Then
                        If S.KOS(0).BewegungsartenVertauschungOrg.Length > 0 Then
                            For I = 0 To S.KOS(0).BewegungsartenVertauschungOrg.Length - 1
                                If S.KOS(0).BewegungsartenVertauschungOrg(I) = Bewegungsarte Then
                                    Return S.KOS(0).BewegungsartenVertauschungNew(I)
                                End If
                            Next
                        End If
                    End If
                End If
            End If
            Return Bewegungsarte
        End Get
        Set(ByVal value As String)
            Bewegungsarte = value
        End Set
    End Property
    Public Sicht As Integer
    Public Function GetSicht(ByVal X1 As Integer, ByVal Y1 As Integer) As Integer
        Dim Rueckgabe As Integer = Sicht
        If Objektverwalter.Spielfeld.Regeln.Wetter = ObjektSpielfeld.Wetterarten.Regen Then
            Select Case DataSettings.CommanderWarsGameModus
                Case CommanderWarsGameModi.AdvanceWarsDC, CommanderWarsGameModi.CommanderWars2
                    If Not GetSpieler.KOS(0).Wetterimmunitaet.Contains(ObjektSpielfeld.Wetterarten.Regen) Then
                        'Nicht nur Kriegsnebel Nee auch noch Standard Sicht = 1. Des nen i aufair
                        Rueckgabe = 1
                    End If
            End Select
        End If
        Dim Spieler As ObjektSpieler = GetSpieler()
        If Spieler.KOS IsNot Nothing Then
            Rueckgabe += Spieler.KOS(0).Sichtbonus * Spieler.KOS(0).GetKOZoneBoost(X1, Y1)
        End If
        If Bewegungsart = MovementSorts.Fuss.ToString Or Bewegungsart = MovementSorts.Mech.ToString Then
            If Objektverwalter.Spielfeld.Landschaften(X1, Y1, Me.GetMap).getID = "BERG" Or Objektverwalter.Spielfeld.Landschaften(X1, Y1, Me.GetMap).getID = "FELSEN" Or Objektverwalter.Spielfeld.Landschaften(X1, Y1, Me.GetMap).getID = "GIPFEL" Then
                Rueckgabe += 3
            End If
        End If
        Rueckgabe += SichtBonus
        Return Rueckgabe
    End Function
    Public Function GetSicht() As Integer
        Return GetSicht(X, Y)
    End Function
    Public KannBesetzen As Boolean = False
    Public KannTarnen As Boolean = False
    ''' <summary>
    ''' Die Einheiten die diese Einheit aufnehmen kann
    ''' </summary>
    ''' <remarks></remarks>
    Public GeladeneEinheitenIDs() As String = {}
    Public EntladungsUntergrund() As String = {}
    Public Waffen1 As String
    Public Property Waffe1() As String
        Get
            If Waffen1.StartsWith("Material") Then Return "Keine"
            Return Waffen1
        End Get
        Set(ByVal value As String)
            Waffen1 = value
        End Set
    End Property
    Public Waffen2 As String
    Public Property Waffe2() As String
        Get
            If Waffen2.StartsWith("Material") Then Return "Keine"
            Return Waffen2
        End Get
        Set(ByVal value As String)
            Waffen2 = value
        End Set
    End Property
    Dim Sichtbarkeit As Boolean = True
    Property Sichtbar() As Boolean
        Get
            Return Sichtbarkeit
        End Get
        Set(ByVal value As Boolean)
            Sichtbarkeit = value
        End Set
    End Property
    Protected Reichweitemin As Integer
    Public Property MinimaleReichweite() As Integer
        Get
            If DataSettings.CommanderWarsGameModus <> CommanderWarsGameModi.FireEmblem Then
                Return Reichweitemin
            Else
                Dim Min As Integer = -1
                Dim E As Fire_Emblem_MOD.FEUnit = Me
                For I = 0 To E.Items.Length - 1
                    If E.Items(I).CanUse(E) Then
                        If E.Items(I).MinRange > 0 Then
                            If E.Items(I).MinRange < Min Or Min <= 0 Then
                                Min = E.Items(I).MinRange
                            End If
                        End If
                    End If
                Next
                Return Min
            End If
        End Get
        Set(ByVal value As Integer)
            Reichweitemin = value
        End Set
    End Property
    Public Reichweitemax As Integer
    ''' <summary>
    ''' Das Leben der Einheit in der KI-Berechnung.
    ''' </summary>
    ''' <remarks></remarks>
    Public VirtuellesLeben As Single = 0
    Public VirtuellerMeistSchaden As Integer = 0
    Public Property MaximaleReichweite() As Integer
        Get
            If DataSettings.CommanderWarsGameModus <> CommanderWarsGameModi.FireEmblem Then
                If EinheitenID <> "BOMBER" And EinheitenID <> "ZEPPELIN" Then
                    If Not Waffe2 = "Keine" Then
                        If Reichweitemax = 1 Then
                            Dim S As ObjektSpieler = GetSpieler()
                            If Not S Is Nothing Then
                                Return Reichweitemax + GetSpieler.KOS(0).NahkampfReichweitenBonus * S.KOS(0).GetKOZoneBoost(Me)
                            Else
                                Return Reichweitemax
                            End If
                        Else
                            Dim RMax As Integer = Reichweitemax + ReichweitenBonus
                            If Not Objektverwalter.Spielfeld Is Nothing Then
                                Dim S As Integer = Spieler
                                If S < 0 Then S = Objektverwalter.Spielfeld.AktuellerSpieler.Spieler
                                RMax += Objektverwalter.Spielfeld.Spieler(S).KOS(0).Reichweite * Objektverwalter.Spielfeld.Spieler(S).KOS(0).GetKOZoneBoost(X, Y)
                                Dim Stelle As Integer = Array.IndexOf(Objektverwalter.Spielfeld.AktuellerSpieler.KOS(0).WetterartfuerSenker, Objektverwalter.Spielfeld.Regeln.Wetter)
                                If Stelle >= 0 Then
                                    Select Case Objektverwalter.Spielfeld.AktuellerSpieler.KOS(0).WetterartfuerSenker(Stelle)
                                        Case ObjektSpielfeld.Wetterarten.Schnee
                                            If Bewegungsart.ToLower <> "wuestenketten" Then
                                                RMax += Objektverwalter.Spielfeld.AktuellerSpieler.KOS(0).WetterReichweitenbonus(Stelle)
                                            End If
                                        Case ObjektSpielfeld.Wetterarten.Sandsturm
                                            If Bewegungsart.ToLower <> "schneeketten" Then
                                                RMax += Objektverwalter.Spielfeld.AktuellerSpieler.KOS(0).WetterReichweitenbonus(Stelle)
                                            End If
                                        Case Else
                                            RMax += Objektverwalter.Spielfeld.AktuellerSpieler.KOS(0).WetterReichweitenbonus(Stelle)
                                    End Select
                                End If

                            End If
                            If Reichweitemax < MinimaleReichweite Then
                                RMax = MinimaleReichweite
                            End If
                            'Haben wir Munition und eine Waffe 1?
                            If Munition <= 0 Then
                                If Waffe1 <> "Keine" Then
                                    RMax = 1
                                Else
                                    RMax = -1
                                End If
                            End If
                            'Noch ein paar andere Veraenderungen wenn wir die Aktuelle Einheit steuern
                            If Objektverwalter.Spielfeld IsNot Nothing Then
                                If Objektverwalter.Spielfeld.AktuelleEinheit IsNot Nothing Then
                                    If Me.Equals(Objektverwalter.Spielfeld.AktuelleEinheit) Then
                                        If Objektverwalter.Spielfeld.Laufen IsNot Nothing Then
                                            If Objektverwalter.Spielfeld.AktuellerSpieler.KOS(0).MoveandFire = False Then
                                                If Objektverwalter.Spielfeld.AktuelleEinheit.Faehigkeit <> "MoveAndFire" Then
                                                    If Objektverwalter.Spielfeld.Laufen.Position <> Objektverwalter.Spielfeld.AktuelleEinheitPosition Then
                                                        If MinimaleReichweite = 1 Then
                                                            Select Case DataSettings.CommanderWarsGameModus
                                                                Case CommanderWarsGameModi.AdvanceWarsDC
                                                                    RMax = -1
                                                                Case Else
                                                                    RMax = 1
                                                            End Select
                                                        ElseIf Waffe1 <> "Keine" Then
                                                            RMax = 1
                                                        Else
                                                            RMax = -1
                                                        End If
                                                    End If
                                                End If
                                            End If
                                        End If
                                    End If
                                End If
                            End If
                            Return RMax
                        End If
                    ElseIf Waffe1 <> "Keine" Then
                        Return 1
                    Else
                        Return -1
                    End If
                Else
                    'Bomben fallen nunmal auf den Boden und nichts anderes!
                    Return Reichweitemax
                End If
            Else
                Dim Max As Integer = -1
                Dim E As Fire_Emblem_MOD.FEUnit = Me
                For I = 0 To E.Items.Length - 1
                    If E.Items(I).CanUse(E) Then
                        If E.Items(I).MaxRange > 0 Then
                            If E.Items(I).MaxRange > Max Then
                                Max = E.Items(I).MaxRange
                            End If
                        End If
                    End If
                Next
                Return Max
            End If
        End Get
        Set(ByVal value As Integer)
            Reichweitemax = value
        End Set
    End Property
    Private Faehigkeite As String = ""
    Public Property Faehigkeit() As String
        Get
            Return Faehigkeite
        End Get
        Set(ByVal value As String)
            Faehigkeite = value
        End Set
    End Property
    Public Koste As Integer
    Public ReadOnly Property Kosten() As Integer
        Get
            If Objektverwalter.Spielfeld IsNot Nothing Then
                Dim Verteuerung As Integer = CountUnits() * Objektverwalter.Spielfeld.Regeln.Teurungsrate
                Return Koste + Verteuerung
            Else
                Return Koste
            End If
        End Get
    End Property
    Private Explosione As String
    Public Property Explosion() As String
        Get
            Return Explosione
        End Get
        Set(ByVal value As String)
            Explosione = value
        End Set
    End Property



    Public Sub IncreaseRadioaktiveVerseuchung(ByVal Wert As Integer)
        RadioaktiveVerseuchung += Wert
        If RadioaktiveVerseuchung < 0 Then RadioaktiveVerseuchung = 0
    End Sub
    Public Sub ResetWerte()
        ATKDEFBoost = New Point(0, 0)
        KannReapariertWerden = True
        Bewegungsbonus = 0
        Feldtarnung = False
        BesetzungsBonus = 0
        ReichweitenBonus = 0
        SichtBonus = 0
        TreibstoffSenkung = 0
        For I = 1 To 2
            If RadioaktiveVerseuchung > 0 Then
                RadioaktiveVerseuchung -= 1
                Leben -= 5
            End If
        Next
        If Leben <= 0 Then Leben = 1
        If RadioaktiveVerseuchung < 0 Then RadioaktiveVerseuchung = 0
    End Sub
    Public Sub RestoreUnit(ByVal Einheit As ObjektEinheit)
        'Noch ein paar andere Sachen laden.
        ATKDEFBoost = Einheit.ATKDEFBoost
        KannReapariertWerden = Einheit.KannReapariertWerden
        Bewegungsbonus = Einheit.Bewegungsbonus
        RadioaktiveVerseuchung = Einheit.RadioaktiveVerseuchung
        Feldtarnung = Einheit.Feldtarnung
        TruppenStufe = Einheit.TruppenStufe
        Rotation = Einheit.Rotation
        AnimPos = Einheit.AnimPos
        AnimPeriode = Einheit.AnimPeriode
        If Einheit.AnimSetName IsNot Nothing Then
            AnimSetName = Einheit.AnimSetName
        End If
        If Einheit.AnimSetNaechsterName IsNot Nothing Then
            AnimSetNaechsterName = Einheit.AnimSetNaechsterName
        End If
        AnimAuszeit = Einheit.AnimAuszeit
    End Sub

#Region "Enumerrattion"



#End Region
#End Region
#Region "Einheit erschaffen"
    Public Sub New(ByVal neuSpieler As Integer, ByVal neuX As Integer, ByVal neuY As Integer, Optional ByVal Hatsichbewegt As Boolean = True)
        Spieler = neuSpieler
        DatenLaden()
        X = neuX
        Y = neuY
        Frames = Zufallszahl(0, 3)
        KP = 100
        Bewegt = Hatsichbewegt
        If ObjektEinheit3D.getEinheit(EinheitenID) IsNot Nothing Then
            AnimController = ObjektEinheit3D.getEinheit(EinheitenID).Mesh.getNewAnimationC
        End If
        Battlemap = -1
    End Sub
    Public Sub New(ByVal neuKP As Integer, ByVal neuTreibstoff As Integer, ByVal neuMunition As Integer, ByVal neuSpieler As Integer, ByVal neuX As Integer, ByVal neuY As Integer, ByVal neuBesetzen As Boolean, ByVal HatSichbeWegt As Boolean, ByVal Tarnung As Boolean)
        Spieler = neuSpieler
        DatenLaden()
        X = neuX
        Y = neuY
        Frames = Zufallszahl(0, 3)
        Leben = neuKP
        Muni = neuMunition
        Sprit = neuTreibstoff
        Besetzung = neuBesetzen
        Bewegt = HatSichbeWegt
        Me.Tarnung = Tarnung
        If ObjektEinheit3D.getEinheit(EinheitenID) IsNot Nothing Then
            AnimController = ObjektEinheit3D.getEinheit(EinheitenID).Mesh.getNewAnimationC
        End If
        Battlemap = -1
    End Sub
    Public Sub New(ByVal neuKP As Integer, ByVal neuSpieler As Integer, ByVal neuX As Integer, ByVal neuY As Integer, ByVal HatSichbeWegt As Boolean)
        Spieler = neuSpieler
        DatenLaden()
        X = neuX
        Y = neuY
        Frames = Zufallszahl(0, 3)
        Bewegt = HatSichbeWegt
        Leben = neuKP
        If ObjektEinheit3D.getEinheit(EinheitenID) IsNot Nothing Then
            AnimController = ObjektEinheit3D.getEinheit(EinheitenID).Mesh.getNewAnimationC
        End If
        Battlemap = -1
    End Sub
    Public Sub BildIDbestimmen()
        For I = 0 To Objektverwalter.AlleEinheiten.Length - 1
            If Objektverwalter.AlleEinheiten(I).EinheitenID = EinheitenID Then
                BildID = I
                Exit For
            End If
        Next
    End Sub
    Protected MustOverride Sub DatenLaden()
#Region "Load and Save"
    Public Sub Write(ByRef StrW As Filestream, ByVal X As Integer, ByVal Y As Integer, ByVal Schlacht As Integer, ByVal Units As List(Of String))
        Dim B() As Byte = IntToBytes(Units.IndexOf(EinheitenIDD))
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(X)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(Y)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(Schlacht)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(Besitzer)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(Bewegt)
        B = DoubleToBytes(AnimPos)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = DoubleToBytes(AnimPeriode)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(AnimAuszeit)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = SingletoBytes(Rotation)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        WriteString(StrW, AnimSetName)
        WriteString(StrW, AnimSetNaechsterName)
        If ATKDEFBoost.X <> 0 Or ATKDEFBoost.Y <> 0 Or KannReapariertWerden = False Or Bewegungsbonus <> 0 Or RadioaktiveVerseuchung <> 0 Or _
        Feldtarnung = True Or BesetzungsBonus <> 0 Or ReichweitenBonus <> 0 Or SichtBonus <> 0 Or TreibstoffSenkung <> 0 Then
            If AIUse <> AISetting.Standard Then
                If HasLadung() Then
                    If Tarnung Then
                        If Besetzung Then
                            If TruppenStufe <> Stufe.Soldat Or Leben <> 100 Or Sprit <> SpritMax Or Muni <> MunitionMax Then
                                WriteV0(StrW, Units)
                            Else
                                WriteV1(StrW, Units)
                            End If
                        Else
                            If TruppenStufe <> Stufe.Soldat Or Leben <> 100 Or Sprit <> SpritMax Or Muni <> MunitionMax Then
                                WriteV2(StrW, Units)
                            Else
                                WriteV3(StrW, Units)
                            End If
                        End If
                    Else
                        If Besetzung Then
                            If TruppenStufe <> Stufe.Soldat Or Leben <> 100 Or Sprit <> SpritMax Or Muni <> MunitionMax Then
                                WriteV4(StrW, Units)
                            Else
                                WriteV5(StrW, Units)
                            End If
                        Else
                            If TruppenStufe <> Stufe.Soldat Or Leben <> 100 Or Sprit <> SpritMax Or Muni <> MunitionMax Then
                                WriteV6(StrW, Units)
                            Else
                                WriteV7(StrW, Units)
                            End If
                        End If
                    End If
                Else
                    If Tarnung Then
                        If Besetzung Then
                            If TruppenStufe <> Stufe.Soldat Or Leben <> 100 Or Sprit <> SpritMax Or Muni <> MunitionMax Then
                                WriteV8(StrW, Units)
                            Else
                                WriteV9(StrW, Units)
                            End If
                        Else
                            If TruppenStufe <> Stufe.Soldat Or Leben <> 100 Or Sprit <> SpritMax Or Muni <> MunitionMax Then
                                WriteV10(StrW, Units)
                            Else
                                WriteV11(StrW, Units)
                            End If
                        End If
                    Else
                        If Besetzung Then
                            If TruppenStufe <> Stufe.Soldat Or Leben <> 100 Or Sprit <> SpritMax Or Muni <> MunitionMax Then
                                WriteV12(StrW, Units)
                            Else
                                WriteV13(StrW, Units)
                            End If
                        Else
                            If TruppenStufe <> Stufe.Soldat Or Leben <> 100 Or Sprit <> SpritMax Or Muni <> MunitionMax Then
                                WriteV14(StrW, Units)
                            Else
                                WriteV15(StrW, Units)
                            End If
                        End If
                    End If
                End If
            Else
                If HasLadung() Then
                    If Tarnung Then
                        If Besetzung Then
                            If TruppenStufe <> Stufe.Soldat Or Leben <> 100 Or Sprit <> SpritMax Or Muni <> MunitionMax Then
                                WriteV16(StrW, Units)
                            Else
                                WriteV17(StrW, Units)
                            End If
                        Else
                            If TruppenStufe <> Stufe.Soldat Or Leben <> 100 Or Sprit <> SpritMax Or Muni <> MunitionMax Then
                                WriteV18(StrW, Units)
                            Else
                                WriteV19(StrW, Units)
                            End If
                        End If
                    Else
                        If Besetzung Then
                            If TruppenStufe <> Stufe.Soldat Or Leben <> 100 Or Sprit <> SpritMax Or Muni <> MunitionMax Then
                                WriteV20(StrW, Units)
                            Else
                                WriteV21(StrW, Units)
                            End If
                        Else
                            If TruppenStufe <> Stufe.Soldat Or Leben <> 100 Or Sprit <> SpritMax Or Muni <> MunitionMax Then
                                WriteV22(StrW, Units)
                            Else
                                WriteV23(StrW, Units)
                            End If
                        End If
                    End If
                Else
                    If Tarnung Then
                        If Besetzung Then
                            If TruppenStufe <> Stufe.Soldat Or Leben <> 100 Or Sprit <> SpritMax Or Muni <> MunitionMax Then
                                WriteV24(StrW, Units)
                            Else
                                WriteV25(StrW, Units)
                            End If
                        Else
                            If TruppenStufe <> Stufe.Soldat Or Leben <> 100 Or Sprit <> SpritMax Or Muni <> MunitionMax Then
                                WriteV26(StrW, Units)
                            Else
                                WriteV27(StrW, Units)
                            End If
                        End If
                    Else
                        If Besetzung Then
                            If TruppenStufe <> Stufe.Soldat Or Leben <> 100 Or Sprit <> SpritMax Or Muni <> MunitionMax Then
                                WriteV28(StrW, Units)
                            Else
                                WriteV29(StrW, Units)
                            End If
                        Else
                            If TruppenStufe <> Stufe.Soldat Or Leben <> 100 Or Sprit <> SpritMax Or Muni <> MunitionMax Then
                                WriteV30(StrW, Units)
                            Else
                                WriteV31(StrW, Units)
                            End If
                        End If
                    End If
                End If
            End If
        Else
            If AIUse <> AISetting.Standard Then
                If HasLadung() Then
                    If Tarnung Then
                        If Besetzung Then
                            If TruppenStufe <> Stufe.Soldat Or Leben <> 100 Or Sprit <> SpritMax Or Muni <> MunitionMax Then
                                WriteV32(StrW, Units)
                            Else
                                WriteV33(StrW, Units)
                            End If
                        Else
                            If TruppenStufe <> Stufe.Soldat Or Leben <> 100 Or Sprit <> SpritMax Or Muni <> MunitionMax Then
                                WriteV34(StrW, Units)
                            Else
                                WriteV35(StrW, Units)
                            End If
                        End If
                    Else
                        If Besetzung Then
                            If TruppenStufe <> Stufe.Soldat Or Leben <> 100 Or Sprit <> SpritMax Or Muni <> MunitionMax Then
                                WriteV36(StrW, Units)
                            Else
                                WriteV37(StrW, Units)
                            End If
                        Else
                            If TruppenStufe <> Stufe.Soldat Or Leben <> 100 Or Sprit <> SpritMax Or Muni <> MunitionMax Then
                                WriteV38(StrW, Units)
                            Else
                                WriteV39(StrW, Units)
                            End If
                        End If
                    End If
                Else
                    If Tarnung Then
                        If Besetzung Then
                            If TruppenStufe <> Stufe.Soldat Or Leben <> 100 Or Sprit <> SpritMax Or Muni <> MunitionMax Then
                                WriteV40(StrW, Units)
                            Else
                                WriteV41(StrW, Units)
                            End If
                        Else
                            If TruppenStufe <> Stufe.Soldat Or Leben <> 100 Or Sprit <> SpritMax Or Muni <> MunitionMax Then
                                WriteV42(StrW, Units)
                            Else
                                WriteV43(StrW, Units)
                            End If
                        End If
                    Else
                        If Besetzung Then
                            If TruppenStufe <> Stufe.Soldat Or Leben <> 100 Or Sprit <> SpritMax Or Muni <> MunitionMax Then
                                WriteV44(StrW, Units)
                            Else
                                WriteV45(StrW, Units)
                            End If
                        Else
                            If TruppenStufe <> Stufe.Soldat Or Leben <> 100 Or Sprit <> SpritMax Or Muni <> MunitionMax Then
                                WriteV46(StrW, Units)
                            Else
                                WriteV47(StrW, Units)
                            End If
                        End If
                    End If
                End If
            Else
                If HasLadung() Then
                    If Tarnung Then
                        If Besetzung Then
                            If TruppenStufe <> Stufe.Soldat Or Leben <> 100 Or Sprit <> SpritMax Or Muni <> MunitionMax Then
                                WriteV48(StrW, Units)
                            Else
                                WriteV49(StrW, Units)
                            End If
                        Else
                            If TruppenStufe <> Stufe.Soldat Or Leben <> 100 Or Sprit <> SpritMax Or Muni <> MunitionMax Then
                                WriteV50(StrW, Units)
                            Else
                                WriteV51(StrW, Units)
                            End If
                        End If
                    Else
                        If Besetzung Then
                            If TruppenStufe <> Stufe.Soldat Or Leben <> 100 Or Sprit <> SpritMax Or Muni <> MunitionMax Then
                                WriteV52(StrW, Units)
                            Else
                                WriteV53(StrW, Units)
                            End If
                        Else
                            If TruppenStufe <> Stufe.Soldat Or Leben <> 100 Or Sprit <> SpritMax Or Muni <> MunitionMax Then
                                WriteV54(StrW, Units)
                            Else
                                WriteV55(StrW, Units)
                            End If
                        End If
                    End If
                Else
                    If Tarnung Then
                        If Besetzung Then
                            If TruppenStufe <> Stufe.Soldat Or Leben <> 100 Or Sprit <> SpritMax Or Muni <> MunitionMax Then
                                WriteV56(StrW, Units)
                            Else
                                WriteV57(StrW, Units)
                            End If
                        Else
                            If TruppenStufe <> Stufe.Soldat Or Leben <> 100 Or Sprit <> SpritMax Or Muni <> MunitionMax Then
                                WriteV58(StrW, Units)
                            Else
                                WriteV59(StrW, Units)
                            End If
                        End If
                    Else
                        If Besetzung Then
                            If TruppenStufe <> Stufe.Soldat Or Leben <> 100 Or Sprit <> SpritMax Or Muni <> MunitionMax Then
                                WriteV60(StrW, Units)
                            Else
                                WriteV61(StrW, Units)
                            End If
                        Else
                            If TruppenStufe <> Stufe.Soldat Or Leben <> 100 Or Sprit <> SpritMax Or Muni <> MunitionMax Then
                                WriteV62(StrW, Units)
                            Else
                                WriteV63(StrW, Units)
                            End If
                        End If
                    End If
                End If
            End If
        End If
    End Sub
    Private Sub WriteV0(ByRef StrW As Filestream, ByVal Units As List(Of String))
        StrW.WriteByte(0)
        Dim B() As Byte
        B = IntToBytes(ATKDEFBoost.X)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ATKDEFBoost.Y)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(KannReapariertWerden)
        B = IntToBytes(Bewegungsbonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(RadioaktiveVerseuchung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(Feldtarnung)
        B = IntToBytes(BesetzungsBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ReichweitenBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(SichtBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(TreibstoffSenkung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(AIUse)
        For I = 0 To Ladung.Length - 1
            If Ladung(I) IsNot Nothing Then
                Ladung(I).Write(StrW, 0, 0, 0, Units)
            End If
        Next
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(Tarnung)
        StrW.WriteByte(Besetzung)
        StrW.WriteByte(TruppenStufe)
        B = SingletoBytes(Leben)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(Sprit)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        If Muni >= 0 Then
            StrW.WriteByte(Muni)
        Else
            StrW.WriteByte(0)
        End If
    End Sub
    Private Sub WriteV1(ByRef StrW As Filestream, ByVal Units As List(Of String))
        StrW.WriteByte(1)
        Dim B() As Byte
        B = IntToBytes(ATKDEFBoost.X)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ATKDEFBoost.Y)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(KannReapariertWerden)
        B = IntToBytes(Bewegungsbonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(RadioaktiveVerseuchung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(Feldtarnung)
        B = IntToBytes(BesetzungsBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ReichweitenBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(SichtBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(TreibstoffSenkung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(AIUse)
        For I = 0 To Ladung.Length - 1
            If Ladung(I) IsNot Nothing Then
                Ladung(I).Write(StrW, 0, 0, 0, Units)
            End If
        Next
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(Tarnung)
        StrW.WriteByte(Besetzung)
    End Sub
    Private Sub WriteV2(ByRef StrW As Filestream, ByVal Units As List(Of String))
        StrW.WriteByte(2)
        Dim B() As Byte
        B = IntToBytes(ATKDEFBoost.X)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ATKDEFBoost.Y)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(KannReapariertWerden)
        B = IntToBytes(Bewegungsbonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(RadioaktiveVerseuchung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(Feldtarnung)
        B = IntToBytes(BesetzungsBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ReichweitenBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(SichtBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(TreibstoffSenkung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(AIUse)
        For I = 0 To Ladung.Length - 1
            If Ladung(I) IsNot Nothing Then
                Ladung(I).Write(StrW, 0, 0, 0, Units)
            End If
        Next
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(Tarnung)
        StrW.WriteByte(TruppenStufe)
        B = SingletoBytes(Leben)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(Sprit)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        If Muni >= 0 Then
            StrW.WriteByte(Muni)
        Else
            StrW.WriteByte(0)
        End If
    End Sub
    Private Sub WriteV3(ByRef StrW As Filestream, ByVal Units As List(Of String))
        StrW.WriteByte(3)
        Dim B() As Byte
        B = IntToBytes(ATKDEFBoost.X)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ATKDEFBoost.Y)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(KannReapariertWerden)
        B = IntToBytes(Bewegungsbonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(RadioaktiveVerseuchung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(Feldtarnung)
        B = IntToBytes(BesetzungsBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ReichweitenBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(SichtBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(TreibstoffSenkung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(AIUse)
        For I = 0 To Ladung.Length - 1
            If Ladung(I) IsNot Nothing Then
                Ladung(I).Write(StrW, 0, 0, 0, Units)
            End If
        Next
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(Tarnung)
    End Sub
    Private Sub WriteV4(ByRef StrW As Filestream, ByVal Units As List(Of String))
        StrW.WriteByte(4)
        Dim B() As Byte
        B = IntToBytes(ATKDEFBoost.X)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ATKDEFBoost.Y)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(KannReapariertWerden)
        B = IntToBytes(Bewegungsbonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(RadioaktiveVerseuchung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(Feldtarnung)
        B = IntToBytes(BesetzungsBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ReichweitenBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(SichtBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(TreibstoffSenkung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(AIUse)
        For I = 0 To Ladung.Length - 1
            If Ladung(I) IsNot Nothing Then
                Ladung(I).Write(StrW, 0, 0, 0, Units)
            End If
        Next
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(Besetzung)
        StrW.WriteByte(TruppenStufe)
        B = SingletoBytes(Leben)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(Sprit)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        If Muni >= 0 Then
            StrW.WriteByte(Muni)
        Else
            StrW.WriteByte(0)
        End If
    End Sub
    Private Sub WriteV5(ByRef StrW As Filestream, ByVal Units As List(Of String))
        StrW.WriteByte(5)
        Dim B() As Byte
        B = IntToBytes(ATKDEFBoost.X)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ATKDEFBoost.Y)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(KannReapariertWerden)
        B = IntToBytes(Bewegungsbonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(RadioaktiveVerseuchung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(Feldtarnung)
        B = IntToBytes(BesetzungsBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ReichweitenBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(SichtBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(TreibstoffSenkung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(AIUse)
        For I = 0 To Ladung.Length - 1
            If Ladung(I) IsNot Nothing Then
                Ladung(I).Write(StrW, 0, 0, 0, Units)
            End If
        Next
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(Besetzung)
    End Sub
    Private Sub WriteV6(ByRef StrW As Filestream, ByVal Units As List(Of String))
        StrW.WriteByte(6)
        Dim B() As Byte
        B = IntToBytes(ATKDEFBoost.X)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ATKDEFBoost.Y)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(KannReapariertWerden)
        B = IntToBytes(Bewegungsbonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(RadioaktiveVerseuchung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(Feldtarnung)
        B = IntToBytes(BesetzungsBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ReichweitenBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(SichtBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(TreibstoffSenkung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(AIUse)
        For I = 0 To Ladung.Length - 1
            If Ladung(I) IsNot Nothing Then
                Ladung(I).Write(StrW, 0, 0, 0, Units)
            End If
        Next
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(TruppenStufe)
        B = SingletoBytes(Leben)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(Sprit)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        If Muni >= 0 Then
            StrW.WriteByte(Muni)
        Else
            StrW.WriteByte(0)
        End If
    End Sub
    Private Sub WriteV7(ByRef StrW As Filestream, ByVal Units As List(Of String))
        StrW.WriteByte(7)
        Dim B() As Byte
        B = IntToBytes(ATKDEFBoost.X)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ATKDEFBoost.Y)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(KannReapariertWerden)
        B = IntToBytes(Bewegungsbonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(RadioaktiveVerseuchung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(Feldtarnung)
        B = IntToBytes(BesetzungsBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ReichweitenBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(SichtBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(TreibstoffSenkung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(AIUse)
        For I = 0 To Ladung.Length - 1
            If Ladung(I) IsNot Nothing Then
                Ladung(I).Write(StrW, 0, 0, 0, Units)
            End If
        Next
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(254)
    End Sub
    Private Sub WriteV8(ByRef StrW As Filestream, ByVal Units As List(Of String))
        StrW.WriteByte(8)
        Dim B() As Byte
        B = IntToBytes(ATKDEFBoost.X)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ATKDEFBoost.Y)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(KannReapariertWerden)
        B = IntToBytes(Bewegungsbonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(RadioaktiveVerseuchung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(Feldtarnung)
        B = IntToBytes(BesetzungsBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ReichweitenBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(SichtBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(TreibstoffSenkung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(AIUse)
        StrW.WriteByte(Tarnung)
        StrW.WriteByte(Besetzung)
        StrW.WriteByte(TruppenStufe)
        B = SingletoBytes(Leben)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(Sprit)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        If Muni >= 0 Then
            StrW.WriteByte(Muni)
        Else
            StrW.WriteByte(0)
        End If
    End Sub
    Private Sub WriteV9(ByRef StrW As Filestream, ByVal Units As List(Of String))
        StrW.WriteByte(9)
        Dim B() As Byte
        B = IntToBytes(ATKDEFBoost.X)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ATKDEFBoost.Y)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(KannReapariertWerden)
        B = IntToBytes(Bewegungsbonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(RadioaktiveVerseuchung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(Feldtarnung)
        B = IntToBytes(BesetzungsBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ReichweitenBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(SichtBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(TreibstoffSenkung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(AIUse)
        StrW.WriteByte(Tarnung)
        StrW.WriteByte(Besetzung)
    End Sub
    Private Sub WriteV10(ByRef StrW As Filestream, ByVal Units As List(Of String))
        StrW.WriteByte(10)
        Dim B() As Byte
        B = IntToBytes(ATKDEFBoost.X)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ATKDEFBoost.Y)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(KannReapariertWerden)
        B = IntToBytes(Bewegungsbonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(RadioaktiveVerseuchung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(Feldtarnung)
        B = IntToBytes(BesetzungsBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ReichweitenBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(SichtBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(TreibstoffSenkung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(AIUse)
        StrW.WriteByte(Tarnung)
        StrW.WriteByte(TruppenStufe)
        B = SingletoBytes(Leben)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(Sprit)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        If Muni >= 0 Then
            StrW.WriteByte(Muni)
        Else
            StrW.WriteByte(0)
        End If
    End Sub
    Private Sub WriteV11(ByRef StrW As Filestream, ByVal Units As List(Of String))
        StrW.WriteByte(11)
        Dim B() As Byte
        B = IntToBytes(ATKDEFBoost.X)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ATKDEFBoost.Y)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(KannReapariertWerden)
        B = IntToBytes(Bewegungsbonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(RadioaktiveVerseuchung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(Feldtarnung)
        B = IntToBytes(BesetzungsBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ReichweitenBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(SichtBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(TreibstoffSenkung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(AIUse)
        StrW.WriteByte(Tarnung)
    End Sub
    Private Sub WriteV12(ByRef StrW As Filestream, ByVal Units As List(Of String))
        StrW.WriteByte(12)
        Dim B() As Byte
        B = IntToBytes(ATKDEFBoost.X)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ATKDEFBoost.Y)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(KannReapariertWerden)
        B = IntToBytes(Bewegungsbonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(RadioaktiveVerseuchung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(Feldtarnung)
        B = IntToBytes(BesetzungsBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ReichweitenBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(SichtBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(TreibstoffSenkung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(AIUse)
        StrW.WriteByte(Besetzung)
        StrW.WriteByte(TruppenStufe)
        B = SingletoBytes(Leben)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(Sprit)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        If Muni >= 0 Then
            StrW.WriteByte(Muni)
        Else
            StrW.WriteByte(0)
        End If
    End Sub
    Private Sub WriteV13(ByRef StrW As Filestream, ByVal Units As List(Of String))
        StrW.WriteByte(13)
        Dim B() As Byte
        B = IntToBytes(ATKDEFBoost.X)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ATKDEFBoost.Y)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(KannReapariertWerden)
        B = IntToBytes(Bewegungsbonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(RadioaktiveVerseuchung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(Feldtarnung)
        B = IntToBytes(BesetzungsBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ReichweitenBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(SichtBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(TreibstoffSenkung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(AIUse)
        StrW.WriteByte(Besetzung)
    End Sub
    Private Sub WriteV14(ByRef StrW As Filestream, ByVal Units As List(Of String))
        StrW.WriteByte(14)
        Dim B() As Byte
        B = IntToBytes(ATKDEFBoost.X)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ATKDEFBoost.Y)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(KannReapariertWerden)
        B = IntToBytes(Bewegungsbonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(RadioaktiveVerseuchung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(Feldtarnung)
        B = IntToBytes(BesetzungsBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ReichweitenBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(SichtBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(TreibstoffSenkung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(AIUse)
        StrW.WriteByte(TruppenStufe)
        B = SingletoBytes(Leben)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(Sprit)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        If Muni >= 0 Then
            StrW.WriteByte(Muni)
        Else
            StrW.WriteByte(0)
        End If
    End Sub
    Private Sub WriteV15(ByRef StrW As Filestream, ByVal Units As List(Of String))
        StrW.WriteByte(15)
        Dim B() As Byte
        B = IntToBytes(ATKDEFBoost.X)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ATKDEFBoost.Y)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(KannReapariertWerden)
        B = IntToBytes(Bewegungsbonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(RadioaktiveVerseuchung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(Feldtarnung)
        B = IntToBytes(BesetzungsBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ReichweitenBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(SichtBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(TreibstoffSenkung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(AIUse)
    End Sub
    Private Sub WriteV16(ByRef StrW As Filestream, ByVal Units As List(Of String))
        StrW.WriteByte(16)
        Dim B() As Byte
        B = IntToBytes(ATKDEFBoost.X)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ATKDEFBoost.Y)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(KannReapariertWerden)
        B = IntToBytes(Bewegungsbonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(RadioaktiveVerseuchung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(Feldtarnung)
        B = IntToBytes(BesetzungsBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ReichweitenBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(SichtBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(TreibstoffSenkung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        For I = 0 To Ladung.Length - 1
            If Ladung(I) IsNot Nothing Then
                Ladung(I).Write(StrW, 0, 0, 0, Units)
            End If
        Next
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(Tarnung)
        StrW.WriteByte(Besetzung)
        StrW.WriteByte(TruppenStufe)
        B = SingletoBytes(Leben)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(Sprit)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        If Muni >= 0 Then
            StrW.WriteByte(Muni)
        Else
            StrW.WriteByte(0)
        End If
    End Sub
    Private Sub WriteV17(ByRef StrW As Filestream, ByVal Units As List(Of String))
        StrW.WriteByte(17)
        Dim B() As Byte
        B = IntToBytes(ATKDEFBoost.X)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ATKDEFBoost.Y)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(KannReapariertWerden)
        B = IntToBytes(Bewegungsbonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(RadioaktiveVerseuchung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(Feldtarnung)
        B = IntToBytes(BesetzungsBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ReichweitenBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(SichtBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(TreibstoffSenkung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        For I = 0 To Ladung.Length - 1
            If Ladung(I) IsNot Nothing Then
                Ladung(I).Write(StrW, 0, 0, 0, Units)
            End If
        Next
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(Tarnung)
        StrW.WriteByte(Besetzung)
    End Sub
    Private Sub WriteV18(ByRef StrW As Filestream, ByVal Units As List(Of String))
        StrW.WriteByte(18)
        Dim B() As Byte
        B = IntToBytes(ATKDEFBoost.X)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ATKDEFBoost.Y)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(KannReapariertWerden)
        B = IntToBytes(Bewegungsbonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(RadioaktiveVerseuchung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(Feldtarnung)
        B = IntToBytes(BesetzungsBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ReichweitenBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(SichtBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(TreibstoffSenkung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        For I = 0 To Ladung.Length - 1
            If Ladung(I) IsNot Nothing Then
                Ladung(I).Write(StrW, 0, 0, 0, Units)
            End If
        Next
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(Tarnung)
        StrW.WriteByte(TruppenStufe)
        B = SingletoBytes(Leben)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(Sprit)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        If Muni >= 0 Then
            StrW.WriteByte(Muni)
        Else
            StrW.WriteByte(0)
        End If
    End Sub
    Private Sub WriteV19(ByRef StrW As Filestream, ByVal Units As List(Of String))
        StrW.WriteByte(19)
        Dim B() As Byte
        B = IntToBytes(ATKDEFBoost.X)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ATKDEFBoost.Y)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(KannReapariertWerden)
        B = IntToBytes(Bewegungsbonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(RadioaktiveVerseuchung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(Feldtarnung)
        B = IntToBytes(BesetzungsBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ReichweitenBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(SichtBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(TreibstoffSenkung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        For I = 0 To Ladung.Length - 1
            If Ladung(I) IsNot Nothing Then
                Ladung(I).Write(StrW, 0, 0, 0, Units)
            End If
        Next
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(Tarnung)
    End Sub
    Private Sub WriteV20(ByRef StrW As Filestream, ByVal Units As List(Of String))
        StrW.WriteByte(20)
        Dim B() As Byte
        B = IntToBytes(ATKDEFBoost.X)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ATKDEFBoost.Y)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(KannReapariertWerden)
        B = IntToBytes(Bewegungsbonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(RadioaktiveVerseuchung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(Feldtarnung)
        B = IntToBytes(BesetzungsBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ReichweitenBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(SichtBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(TreibstoffSenkung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        For I = 0 To Ladung.Length - 1
            If Ladung(I) IsNot Nothing Then
                Ladung(I).Write(StrW, 0, 0, 0, Units)
            End If
        Next
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(Besetzung)
        StrW.WriteByte(TruppenStufe)
        B = SingletoBytes(Leben)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(Sprit)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        If Muni >= 0 Then
            StrW.WriteByte(Muni)
        Else
            StrW.WriteByte(0)
        End If
    End Sub
    Private Sub WriteV21(ByRef StrW As Filestream, ByVal Units As List(Of String))
        StrW.WriteByte(21)
        Dim B() As Byte
        B = IntToBytes(ATKDEFBoost.X)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ATKDEFBoost.Y)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(KannReapariertWerden)
        B = IntToBytes(Bewegungsbonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(RadioaktiveVerseuchung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(Feldtarnung)
        B = IntToBytes(BesetzungsBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ReichweitenBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(SichtBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(TreibstoffSenkung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        For I = 0 To Ladung.Length - 1
            If Ladung(I) IsNot Nothing Then
                Ladung(I).Write(StrW, 0, 0, 0, Units)
            End If
        Next
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(Besetzung)
    End Sub
    Private Sub WriteV22(ByRef StrW As Filestream, ByVal Units As List(Of String))
        StrW.WriteByte(22)
        Dim B() As Byte
        B = IntToBytes(ATKDEFBoost.X)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ATKDEFBoost.Y)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(KannReapariertWerden)
        B = IntToBytes(Bewegungsbonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(RadioaktiveVerseuchung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(Feldtarnung)
        B = IntToBytes(BesetzungsBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ReichweitenBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(SichtBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(TreibstoffSenkung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        For I = 0 To Ladung.Length - 1
            If Ladung(I) IsNot Nothing Then
                Ladung(I).Write(StrW, 0, 0, 0, Units)
            End If
        Next
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(TruppenStufe)
        B = SingletoBytes(Leben)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(Sprit)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        If Muni >= 0 Then
            StrW.WriteByte(Muni)
        Else
            StrW.WriteByte(0)
        End If
    End Sub
    Private Sub WriteV23(ByRef StrW As Filestream, ByVal Units As List(Of String))
        StrW.WriteByte(23)
        Dim B() As Byte
        B = IntToBytes(ATKDEFBoost.X)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ATKDEFBoost.Y)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(KannReapariertWerden)
        B = IntToBytes(Bewegungsbonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(RadioaktiveVerseuchung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(Feldtarnung)
        B = IntToBytes(BesetzungsBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ReichweitenBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(SichtBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(TreibstoffSenkung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        For I = 0 To Ladung.Length - 1
            If Ladung(I) IsNot Nothing Then
                Ladung(I).Write(StrW, 0, 0, 0, Units)
            End If
        Next
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(254)
    End Sub
    Private Sub WriteV24(ByRef StrW As Filestream, ByVal Units As List(Of String))
        StrW.WriteByte(24)
        Dim B() As Byte
        B = IntToBytes(ATKDEFBoost.X)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ATKDEFBoost.Y)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(KannReapariertWerden)
        B = IntToBytes(Bewegungsbonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(RadioaktiveVerseuchung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(Feldtarnung)
        B = IntToBytes(BesetzungsBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ReichweitenBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(SichtBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(TreibstoffSenkung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(Tarnung)
        StrW.WriteByte(Besetzung)
        StrW.WriteByte(TruppenStufe)
        B = SingletoBytes(Leben)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(Sprit)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        If Muni >= 0 Then
            StrW.WriteByte(Muni)
        Else
            StrW.WriteByte(0)
        End If
    End Sub
    Private Sub WriteV25(ByRef StrW As Filestream, ByVal Units As List(Of String))
        StrW.WriteByte(25)
        Dim B() As Byte
        B = IntToBytes(ATKDEFBoost.X)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ATKDEFBoost.Y)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(KannReapariertWerden)
        B = IntToBytes(Bewegungsbonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(RadioaktiveVerseuchung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(Feldtarnung)
        B = IntToBytes(BesetzungsBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ReichweitenBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(SichtBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(TreibstoffSenkung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(Tarnung)
        StrW.WriteByte(Besetzung)
    End Sub
    Private Sub WriteV26(ByRef StrW As Filestream, ByVal Units As List(Of String))
        StrW.WriteByte(26)
        Dim B() As Byte
        B = IntToBytes(ATKDEFBoost.X)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ATKDEFBoost.Y)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(KannReapariertWerden)
        B = IntToBytes(Bewegungsbonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(RadioaktiveVerseuchung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(Feldtarnung)
        B = IntToBytes(BesetzungsBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ReichweitenBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(SichtBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(TreibstoffSenkung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(Tarnung)
        StrW.WriteByte(TruppenStufe)
        B = SingletoBytes(Leben)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(Sprit)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        If Muni >= 0 Then
            StrW.WriteByte(Muni)
        Else
            StrW.WriteByte(0)
        End If
    End Sub
    Private Sub WriteV27(ByRef StrW As Filestream, ByVal Units As List(Of String))
        StrW.WriteByte(27)
        Dim B() As Byte
        B = IntToBytes(ATKDEFBoost.X)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ATKDEFBoost.Y)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(KannReapariertWerden)
        B = IntToBytes(Bewegungsbonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(RadioaktiveVerseuchung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(Feldtarnung)
        B = IntToBytes(BesetzungsBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ReichweitenBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(SichtBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(TreibstoffSenkung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(Tarnung)
    End Sub
    Private Sub WriteV28(ByRef StrW As Filestream, ByVal Units As List(Of String))
        StrW.WriteByte(28)
        Dim B() As Byte
        B = IntToBytes(ATKDEFBoost.X)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ATKDEFBoost.Y)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(KannReapariertWerden)
        B = IntToBytes(Bewegungsbonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(RadioaktiveVerseuchung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(Feldtarnung)
        B = IntToBytes(BesetzungsBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ReichweitenBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(SichtBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(TreibstoffSenkung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(Besetzung)
        StrW.WriteByte(TruppenStufe)
        B = SingletoBytes(Leben)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(Sprit)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        If Muni >= 0 Then
            StrW.WriteByte(Muni)
        Else
            StrW.WriteByte(0)
        End If
    End Sub
    Private Sub WriteV29(ByRef StrW As Filestream, ByVal Units As List(Of String))
        StrW.WriteByte(29)
        Dim B() As Byte
        B = IntToBytes(ATKDEFBoost.X)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ATKDEFBoost.Y)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(KannReapariertWerden)
        B = IntToBytes(Bewegungsbonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(RadioaktiveVerseuchung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(Feldtarnung)
        B = IntToBytes(BesetzungsBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ReichweitenBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(SichtBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(TreibstoffSenkung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(Besetzung)
    End Sub
    Private Sub WriteV30(ByRef StrW As Filestream, ByVal Units As List(Of String))
        StrW.WriteByte(30)
        Dim B() As Byte
        B = IntToBytes(ATKDEFBoost.X)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ATKDEFBoost.Y)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(KannReapariertWerden)
        B = IntToBytes(Bewegungsbonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(RadioaktiveVerseuchung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(Feldtarnung)
        B = IntToBytes(BesetzungsBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ReichweitenBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(SichtBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(TreibstoffSenkung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(TruppenStufe)
        B = SingletoBytes(Leben)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(Sprit)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        If Muni >= 0 Then
            StrW.WriteByte(Muni)
        Else
            StrW.WriteByte(0)
        End If
    End Sub
    Private Sub WriteV31(ByRef StrW As Filestream, ByVal Units As List(Of String))
        StrW.WriteByte(31)
        Dim B() As Byte
        B = IntToBytes(ATKDEFBoost.X)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ATKDEFBoost.Y)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(KannReapariertWerden)
        B = IntToBytes(Bewegungsbonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(RadioaktiveVerseuchung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(Feldtarnung)
        B = IntToBytes(BesetzungsBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ReichweitenBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(SichtBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(TreibstoffSenkung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
    End Sub
    Private Sub WriteV32(ByRef StrW As Filestream, ByVal Units As List(Of String))
        StrW.WriteByte(32)
        Dim B() As Byte
        StrW.WriteByte(AIUse)
        For I = 0 To Ladung.Length - 1
            If Ladung(I) IsNot Nothing Then
                Ladung(I).Write(StrW, 0, 0, 0, Units)
            End If
        Next
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(Tarnung)
        StrW.WriteByte(Besetzung)
        StrW.WriteByte(TruppenStufe)
        B = SingletoBytes(Leben)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(Sprit)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        If Muni >= 0 Then
            StrW.WriteByte(Muni)
        Else
            StrW.WriteByte(0)
        End If
    End Sub
    Private Sub WriteV33(ByRef StrW As Filestream, ByVal Units As List(Of String))
        StrW.WriteByte(33)
        StrW.WriteByte(AIUse)
        For I = 0 To Ladung.Length - 1
            If Ladung(I) IsNot Nothing Then
                Ladung(I).Write(StrW, 0, 0, 0, Units)
            End If
        Next
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(Tarnung)
        StrW.WriteByte(Besetzung)
    End Sub
    Private Sub WriteV34(ByRef StrW As Filestream, ByVal Units As List(Of String))
        StrW.WriteByte(34)
        Dim B() As Byte
        StrW.WriteByte(AIUse)
        For I = 0 To Ladung.Length - 1
            If Ladung(I) IsNot Nothing Then
                Ladung(I).Write(StrW, 0, 0, 0, Units)
            End If
        Next
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(Tarnung)
        StrW.WriteByte(TruppenStufe)
        B = SingletoBytes(Leben)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(Sprit)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        If Muni >= 0 Then
            StrW.WriteByte(Muni)
        Else
            StrW.WriteByte(0)
        End If
    End Sub
    Private Sub WriteV35(ByRef StrW As Filestream, ByVal Units As List(Of String))
        StrW.WriteByte(35)
        StrW.WriteByte(AIUse)
        For I = 0 To Ladung.Length - 1
            If Ladung(I) IsNot Nothing Then
                Ladung(I).Write(StrW, 0, 0, 0, Units)
            End If
        Next
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(Tarnung)
    End Sub
    Private Sub WriteV36(ByRef StrW As Filestream, ByVal Units As List(Of String))
        StrW.WriteByte(36)
        Dim B() As Byte
        StrW.WriteByte(AIUse)
        For I = 0 To Ladung.Length - 1
            If Ladung(I) IsNot Nothing Then
                Ladung(I).Write(StrW, 0, 0, 0, Units)
            End If
        Next
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(Besetzung)
        StrW.WriteByte(TruppenStufe)
        B = SingletoBytes(Leben)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(Sprit)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        If Muni >= 0 Then
            StrW.WriteByte(Muni)
        Else
            StrW.WriteByte(0)
        End If
    End Sub
    Private Sub WriteV37(ByRef StrW As Filestream, ByVal Units As List(Of String))
        StrW.WriteByte(37)
        StrW.WriteByte(AIUse)
        For I = 0 To Ladung.Length - 1
            If Ladung(I) IsNot Nothing Then
                Ladung(I).Write(StrW, 0, 0, 0, Units)
            End If
        Next
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(Besetzung)
    End Sub
    Private Sub WriteV38(ByRef StrW As Filestream, ByVal Units As List(Of String))
        StrW.WriteByte(38)
        Dim B() As Byte
        StrW.WriteByte(AIUse)
        For I = 0 To Ladung.Length - 1
            If Ladung(I) IsNot Nothing Then
                Ladung(I).Write(StrW, 0, 0, 0, Units)
            End If
        Next
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(TruppenStufe)
        B = SingletoBytes(Leben)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(Sprit)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        If Muni >= 0 Then
            StrW.WriteByte(Muni)
        Else
            StrW.WriteByte(0)
        End If
    End Sub
    Private Sub WriteV39(ByRef StrW As Filestream, ByVal Units As List(Of String))
        StrW.WriteByte(39)
        StrW.WriteByte(AIUse)
        For I = 0 To Ladung.Length - 1
            If Ladung(I) IsNot Nothing Then
                Ladung(I).Write(StrW, 0, 0, 0, Units)
            End If
        Next
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(254)
    End Sub
    Private Sub WriteV40(ByRef StrW As Filestream, ByVal Units As List(Of String))
        StrW.WriteByte(40)
        Dim B() As Byte
        StrW.WriteByte(AIUse)
        StrW.WriteByte(Tarnung)
        StrW.WriteByte(Besetzung)
        StrW.WriteByte(TruppenStufe)
        B = SingletoBytes(Leben)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(Sprit)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        If Muni >= 0 Then
            StrW.WriteByte(Muni)
        Else
            StrW.WriteByte(0)
        End If
    End Sub
    Private Sub WriteV41(ByRef StrW As Filestream, ByVal Units As List(Of String))
        StrW.WriteByte(41)
        StrW.WriteByte(AIUse)
        StrW.WriteByte(Tarnung)
        StrW.WriteByte(Besetzung)
    End Sub
    Private Sub WriteV42(ByRef StrW As Filestream, ByVal Units As List(Of String))
        StrW.WriteByte(42)
        Dim B() As Byte
        StrW.WriteByte(AIUse)
        StrW.WriteByte(Tarnung)
        StrW.WriteByte(TruppenStufe)
        B = SingletoBytes(Leben)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(Sprit)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        If Muni >= 0 Then
            StrW.WriteByte(Muni)
        Else
            StrW.WriteByte(0)
        End If
    End Sub
    Private Sub WriteV43(ByRef StrW As Filestream, ByVal Units As List(Of String))
        StrW.WriteByte(43)
        StrW.WriteByte(AIUse)
        StrW.WriteByte(Tarnung)
    End Sub
    Private Sub WriteV44(ByRef StrW As Filestream, ByVal Units As List(Of String))
        StrW.WriteByte(44)
        Dim B() As Byte
        StrW.WriteByte(AIUse)
        StrW.WriteByte(Besetzung)
        StrW.WriteByte(TruppenStufe)
        B = SingletoBytes(Leben)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(Sprit)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        If Muni >= 0 Then
            StrW.WriteByte(Muni)
        Else
            StrW.WriteByte(0)
        End If
    End Sub
    Private Sub WriteV45(ByRef StrW As Filestream, ByVal Units As List(Of String))
        StrW.WriteByte(45)
        StrW.WriteByte(AIUse)
        StrW.WriteByte(Besetzung)
    End Sub
    Private Sub WriteV46(ByRef StrW As Filestream, ByVal Units As List(Of String))
        StrW.WriteByte(46)
        Dim B() As Byte
        StrW.WriteByte(AIUse)
        StrW.WriteByte(TruppenStufe)
        B = SingletoBytes(Leben)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(Sprit)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        If Muni >= 0 Then
            StrW.WriteByte(Muni)
        Else
            StrW.WriteByte(0)
        End If
    End Sub
    Private Sub WriteV47(ByRef StrW As Filestream, ByVal Units As List(Of String))
        StrW.WriteByte(47)
        StrW.WriteByte(AIUse)
    End Sub
    Private Sub WriteV48(ByRef StrW As Filestream, ByVal Units As List(Of String))
        StrW.WriteByte(48)
        Dim B() As Byte
        For I = 0 To Ladung.Length - 1
            If Ladung(I) IsNot Nothing Then
                Ladung(I).Write(StrW, 0, 0, 0, Units)
            End If
        Next
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(Tarnung)
        StrW.WriteByte(Besetzung)
        StrW.WriteByte(TruppenStufe)
        B = SingletoBytes(Leben)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(Sprit)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        If Muni >= 0 Then
            StrW.WriteByte(Muni)
        Else
            StrW.WriteByte(0)
        End If
    End Sub
    Private Sub WriteV49(ByRef StrW As Filestream, ByVal Units As List(Of String))
        StrW.WriteByte(49)
        For I = 0 To Ladung.Length - 1
            If Ladung(I) IsNot Nothing Then
                Ladung(I).Write(StrW, 0, 0, 0, Units)
            End If
        Next
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(Tarnung)
        StrW.WriteByte(Besetzung)
    End Sub
    Private Sub WriteV50(ByRef StrW As Filestream, ByVal Units As List(Of String))
        StrW.WriteByte(50)
        Dim B() As Byte
        For I = 0 To Ladung.Length - 1
            If Ladung(I) IsNot Nothing Then
                Ladung(I).Write(StrW, 0, 0, 0, Units)
            End If
        Next
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(Tarnung)
        StrW.WriteByte(TruppenStufe)
        B = SingletoBytes(Leben)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(Sprit)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        If Muni >= 0 Then
            StrW.WriteByte(Muni)
        Else
            StrW.WriteByte(0)
        End If
    End Sub
    Private Sub WriteV51(ByRef StrW As Filestream, ByVal Units As List(Of String))
        StrW.WriteByte(51)
        For I = 0 To Ladung.Length - 1
            If Ladung(I) IsNot Nothing Then
                Ladung(I).Write(StrW, 0, 0, 0, Units)
            End If
        Next
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(Tarnung)
    End Sub
    Private Sub WriteV52(ByRef StrW As Filestream, ByVal Units As List(Of String))
        StrW.WriteByte(52)
        Dim B() As Byte
        For I = 0 To Ladung.Length - 1
            If Ladung(I) IsNot Nothing Then
                Ladung(I).Write(StrW, 0, 0, 0, Units)
            End If
        Next
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(Besetzung)
        StrW.WriteByte(TruppenStufe)
        B = SingletoBytes(Leben)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(Sprit)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        If Muni >= 0 Then
            StrW.WriteByte(Muni)
        Else
            StrW.WriteByte(0)
        End If
    End Sub
    Private Sub WriteV53(ByRef StrW As Filestream, ByVal Units As List(Of String))
        StrW.WriteByte(53)
        For I = 0 To Ladung.Length - 1
            If Ladung(I) IsNot Nothing Then
                Ladung(I).Write(StrW, 0, 0, 0, Units)
            End If
        Next
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(Besetzung)
    End Sub
    Private Sub WriteV54(ByRef StrW As Filestream, ByVal Units As List(Of String))
        StrW.WriteByte(54)
        Dim B() As Byte
        For I = 0 To Ladung.Length - 1
            If Ladung(I) IsNot Nothing Then
                Ladung(I).Write(StrW, 0, 0, 0, Units)
            End If
        Next
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(TruppenStufe)
        B = SingletoBytes(Leben)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(Sprit)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        If Muni >= 0 Then
            StrW.WriteByte(Muni)
        Else
            StrW.WriteByte(0)
        End If
    End Sub
    Private Sub WriteV55(ByRef StrW As Filestream, ByVal Units As List(Of String))
        StrW.WriteByte(55)
        For I = 0 To Ladung.Length - 1
            If Ladung(I) IsNot Nothing Then
                Ladung(I).Write(StrW, 0, 0, 0, Units)
            End If
        Next
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(254)
        StrW.WriteByte(254)
    End Sub
    Private Sub WriteV56(ByRef StrW As Filestream, ByVal Units As List(Of String))
        StrW.WriteByte(56)
        Dim B() As Byte
        B = IntToBytes(ATKDEFBoost.X)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ATKDEFBoost.Y)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(KannReapariertWerden)
        B = IntToBytes(Bewegungsbonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(RadioaktiveVerseuchung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(Feldtarnung)
        B = IntToBytes(BesetzungsBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(ReichweitenBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(SichtBonus)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(TreibstoffSenkung)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        StrW.WriteByte(Tarnung)
        StrW.WriteByte(Besetzung)
        StrW.WriteByte(TruppenStufe)
        B = SingletoBytes(Leben)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(Sprit)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        If Muni >= 0 Then
            StrW.WriteByte(Muni)
        Else
            StrW.WriteByte(0)
        End If
    End Sub
    Private Sub WriteV57(ByRef StrW As Filestream, ByVal Units As List(Of String))
        StrW.WriteByte(57)
        StrW.WriteByte(Tarnung)
        StrW.WriteByte(Besetzung)
    End Sub
    Private Sub WriteV58(ByRef StrW As Filestream, ByVal Units As List(Of String))
        StrW.WriteByte(58)
        Dim B() As Byte
        StrW.WriteByte(Tarnung)
        StrW.WriteByte(TruppenStufe)
        B = SingletoBytes(Leben)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(Sprit)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        If Muni >= 0 Then
            StrW.WriteByte(Muni)
        Else
            StrW.WriteByte(0)
        End If
    End Sub
    Private Sub WriteV59(ByRef StrW As Filestream, ByVal Units As List(Of String))
        StrW.WriteByte(59)
        StrW.WriteByte(Tarnung)
    End Sub
    Private Sub WriteV60(ByRef StrW As Filestream, ByVal Units As List(Of String))
        StrW.WriteByte(60)
        Dim B() As Byte
        StrW.WriteByte(Besetzung)
        StrW.WriteByte(TruppenStufe)
        B = SingletoBytes(Leben)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(Sprit)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        If Muni >= 0 Then
            StrW.WriteByte(Muni)
        Else
            StrW.WriteByte(0)
        End If
    End Sub
    Private Sub WriteV61(ByRef StrW As Filestream, ByVal Units As List(Of String))
        StrW.WriteByte(61)
        StrW.WriteByte(Besetzung)
    End Sub
    Private Sub WriteV62(ByRef StrW As Filestream, ByVal Units As List(Of String))
        StrW.WriteByte(62)
        Dim B() As Byte
        StrW.WriteByte(TruppenStufe)
        B = SingletoBytes(Leben)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        B = IntToBytes(Sprit)
        For I = 0 To B.Length - 1
            StrW.WriteByte(B(I))
        Next
        If Muni >= 0 Then
            StrW.WriteByte(Muni)
        Else
            StrW.WriteByte(0)
        End If
    End Sub
    Private Sub WriteV63(ByRef StrW As Filestream, ByVal Units As List(Of String))
        StrW.WriteByte(63)
    End Sub
    Public Shared Function Read(ByRef StrR As Filestream, ByVal Units As String(), Optional ByRef Schlachtfeld As Integer = 0) As ObjektEinheit
        Dim B(3) As Byte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        Dim ID As String = Units(BytesToInt(B))
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        Dim X As Integer = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        Dim Y As Integer = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        Schlachtfeld = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        Dim Spieler As Integer = BytesToInt(B)
        Dim Bewegt As Boolean = StrR.ReadByte
        ReDim B(7)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        Dim AnimPos As Double = BytesToDouble(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        Dim AnimPeriode As Double = BytesToDouble(B)
        ReDim B(3)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        Dim AnimAuszeit As Integer = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        Dim Rotation As Single = BytesToSingle(B)
        Dim AnimSetName As String = ReadString(StrR)
        Dim AnimSetNaechsterName As String = ReadString(StrR)
        Dim E As ObjektEinheit = ObjektLadeklasse.NewEinheit(ID, Spieler, X, Y, Bewegt)
        E.AnimPos = AnimPos
        E.AnimPeriode = AnimPeriode
        E.AnimAuszeit = AnimAuszeit
        E.Rotation = Rotation
        E.AnimSetName = AnimSetName
        E.AnimSetNaechsterName = AnimSetNaechsterName
        Select Case StrR.ReadByte
            Case 0
                E = ReadV0(StrR, E, Units)
            Case 1
                E = ReadV1(StrR, E, Units)
            Case 2
                E = ReadV2(StrR, E, Units)
            Case 3
                E = ReadV3(StrR, E, Units)
            Case 4
                E = ReadV4(StrR, E, Units)
            Case 5
                E = ReadV5(StrR, E, Units)
            Case 6
                E = ReadV6(StrR, E, Units)
            Case 7
                E = ReadV7(StrR, E, Units)
            Case 8
                E = ReadV8(StrR, E, Units)
            Case 9
                E = ReadV9(StrR, E, Units)
            Case 10
                E = ReadV10(StrR, E, Units)
            Case 11
                E = ReadV11(StrR, E, Units)
            Case 12
                E = ReadV12(StrR, E, Units)
            Case 13
                E = ReadV13(StrR, E, Units)
            Case 14
                E = ReadV14(StrR, E, Units)
            Case 15
                E = ReadV15(StrR, E, Units)
            Case 16
                E = ReadV16(StrR, E, Units)
            Case 17
                E = ReadV17(StrR, E, Units)
            Case 18
                E = ReadV18(StrR, E, Units)
            Case 19
                E = ReadV19(StrR, E, Units)
            Case 20
                E = ReadV20(StrR, E, Units)
            Case 21
                E = ReadV21(StrR, E, Units)
            Case 22
                E = ReadV22(StrR, E, Units)
            Case 23
                E = ReadV23(StrR, E, Units)
            Case 24
                E = ReadV24(StrR, E, Units)
            Case 25
                E = ReadV25(StrR, E, Units)
            Case 26
                E = ReadV26(StrR, E, Units)
            Case 27
                E = ReadV27(StrR, E, Units)
            Case 28
                E = ReadV28(StrR, E, Units)
            Case 29
                E = ReadV29(StrR, E, Units)
            Case 30
                E = ReadV30(StrR, E, Units)
            Case 31
                E = ReadV31(StrR, E, Units)
            Case 32
                E = ReadV32(StrR, E, Units)
            Case 33
                E = ReadV33(StrR, E, Units)
            Case 34
                E = ReadV34(StrR, E, Units)
            Case 35
                E = ReadV35(StrR, E, Units)
            Case 36
                E = ReadV36(StrR, E, Units)
            Case 37
                E = ReadV37(StrR, E, Units)
            Case 38
                E = ReadV38(StrR, E, Units)
            Case 39
                E = ReadV39(StrR, E, Units)
            Case 40
                E = ReadV40(StrR, E, Units)
            Case 41
                E = ReadV41(StrR, E, Units)
            Case 42
                E = ReadV42(StrR, E, Units)
            Case 43
                E = ReadV43(StrR, E, Units)
            Case 44
                E = ReadV44(StrR, E, Units)
            Case 45
                E = ReadV45(StrR, E, Units)
            Case 46
                E = ReadV46(StrR, E, Units)
            Case 47
                E = ReadV47(StrR, E, Units)
            Case 48
                E = ReadV48(StrR, E, Units)
            Case 49
                E = ReadV49(StrR, E, Units)
            Case 50
                E = ReadV50(StrR, E, Units)
            Case 51
                E = ReadV51(StrR, E, Units)
            Case 52
                E = ReadV52(StrR, E, Units)
            Case 53
                E = ReadV53(StrR, E, Units)
            Case 54
                E = ReadV54(StrR, E, Units)
            Case 55
                E = ReadV55(StrR, E, Units)
            Case 56
                E = ReadV56(StrR, E, Units)
            Case 57
                E = ReadV57(StrR, E, Units)
            Case 58
                E = ReadV58(StrR, E, Units)
            Case 59
                E = ReadV59(StrR, E, Units)
            Case 60
                E = ReadV60(StrR, E, Units)
            Case 61
                E = ReadV61(StrR, E, Units)
            Case 62
                E = ReadV62(StrR, E, Units)
            Case 63
                E = ReadV63(StrR, E, Units)
        End Select

        Return E
    End Function
    Private Shared Function ReadV0(ByRef StrR As Filestream, ByVal E As ObjektEinheit, ByVal Units As String())
        Dim B(3) As Byte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ATKDEFBoost.X = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ATKDEFBoost.Y = BytesToInt(B)
        E.KannReapariertWerden = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Bewegungsbonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.RadioaktiveVerseuchung = BytesToInt(B)
        E.Feldtarnung = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.BesetzungsBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ReichweitenBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.SichtBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.TreibstoffSenkung = BytesToInt(B)
        E.AIUse = StrR.ReadByte
        Dim Counter As Integer = 0
        Dim Ende() As Byte = {0, 0, 0, 0}
        While Not (Ende(0) = 254 And Ende(1) = 254 And Ende(2) = 254 And Ende(3) = 254)
            Ende(0) = StrR.ReadByte
            Ende(1) = StrR.ReadByte
            Ende(2) = StrR.ReadByte
            Ende(3) = StrR.ReadByte
            StrR.Seek(-4)
            If Not (Ende(0) = 254 And Ende(1) = 254 And Ende(2) = 254 And Ende(3) = 254) Then
                E.Ladung(Counter) = ObjektEinheit.Read(StrR, Units)
                E.Ladung(Counter).X = E.X
                E.Ladung(Counter).Y = E.Y
                For I = 0 To E.Ladung(Counter).Ladung.Length - 1
                    E.Ladung(Counter).Ladung(I).X = E.X
                    E.Ladung(Counter).Ladung(I).X = E.Y
                Next
                Counter = 0
            End If
        End While
        StrR.ReadByte()
        StrR.ReadByte()
        StrR.ReadByte()
        StrR.ReadByte()
        E.Tarnung = StrR.ReadByte
        E.Besetzung = StrR.ReadByte
        E.TruppenStufe = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Leben = BytesToSingle(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Sprit = BytesToInt(B)
        E.Muni = StrR.ReadByte
        Return E
    End Function
    Private Shared Function ReadV1(ByRef StrR As Filestream, ByVal E As ObjektEinheit, ByVal Units As String())
        Dim B(3) As Byte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ATKDEFBoost.X = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ATKDEFBoost.Y = BytesToInt(B)
        E.KannReapariertWerden = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Bewegungsbonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.RadioaktiveVerseuchung = BytesToInt(B)
        E.Feldtarnung = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.BesetzungsBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ReichweitenBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.SichtBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.TreibstoffSenkung = BytesToInt(B)
        E.AIUse = StrR.ReadByte
        Dim Counter As Integer = 0
        Dim Ende() As Byte = {0, 0, 0, 0}
        While Not (Ende(0) = 254 And Ende(1) = 254 And Ende(2) = 254 And Ende(3) = 254)
            Ende(0) = StrR.ReadByte
            Ende(1) = StrR.ReadByte
            Ende(2) = StrR.ReadByte
            Ende(3) = StrR.ReadByte
            StrR.Seek(-4)
            If Not (Ende(0) = 254 And Ende(1) = 254 And Ende(2) = 254 And Ende(3) = 254) Then
                E.Ladung(Counter) = ObjektEinheit.Read(StrR, Units)
                E.Ladung(Counter).X = E.X
                E.Ladung(Counter).Y = E.Y
                For I = 0 To E.Ladung(Counter).Ladung.Length - 1
                    E.Ladung(Counter).Ladung(I).X = E.X
                    E.Ladung(Counter).Ladung(I).X = E.Y
                Next
                Counter = 0
            End If
        End While
        StrR.ReadByte()
        StrR.ReadByte()
        StrR.ReadByte()
        StrR.ReadByte()
        E.Tarnung = StrR.ReadByte
        E.Besetzung = StrR.ReadByte
        Return E
    End Function
    Private Shared Function ReadV2(ByRef StrR As Filestream, ByVal E As ObjektEinheit, ByVal Units As String())
        Dim B(3) As Byte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ATKDEFBoost.X = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ATKDEFBoost.Y = BytesToInt(B)
        E.KannReapariertWerden = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Bewegungsbonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.RadioaktiveVerseuchung = BytesToInt(B)
        E.Feldtarnung = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.BesetzungsBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ReichweitenBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.SichtBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.TreibstoffSenkung = BytesToInt(B)
        E.AIUse = StrR.ReadByte
        Dim Counter As Integer = 0
        Dim Ende() As Byte = {0, 0, 0, 0}
        While Not (Ende(0) = 254 And Ende(1) = 254 And Ende(2) = 254 And Ende(3) = 254)
            Ende(0) = StrR.ReadByte
            Ende(1) = StrR.ReadByte
            Ende(2) = StrR.ReadByte
            Ende(3) = StrR.ReadByte
            StrR.Seek(-4)
            If Not (Ende(0) = 254 And Ende(1) = 254 And Ende(2) = 254 And Ende(3) = 254) Then
                E.Ladung(Counter) = ObjektEinheit.Read(StrR, Units)
                E.Ladung(Counter).X = E.X
                E.Ladung(Counter).Y = E.Y
                For I = 0 To E.Ladung(Counter).Ladung.Length - 1
                    E.Ladung(Counter).Ladung(I).X = E.X
                    E.Ladung(Counter).Ladung(I).X = E.Y
                Next
                Counter = 0
            End If
        End While
        StrR.ReadByte()
        StrR.ReadByte()
        StrR.ReadByte()
        StrR.ReadByte()
        E.Tarnung = StrR.ReadByte
        E.TruppenStufe = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Leben = BytesToSingle(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Sprit = BytesToInt(B)
        E.Muni = StrR.ReadByte
        Return E
    End Function
    Private Shared Function ReadV3(ByRef StrR As Filestream, ByVal E As ObjektEinheit, ByVal Units As String())
        Dim B(3) As Byte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ATKDEFBoost.X = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ATKDEFBoost.Y = BytesToInt(B)
        E.KannReapariertWerden = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Bewegungsbonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.RadioaktiveVerseuchung = BytesToInt(B)
        E.Feldtarnung = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.BesetzungsBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ReichweitenBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.SichtBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.TreibstoffSenkung = BytesToInt(B)
        E.AIUse = StrR.ReadByte
        Dim Counter As Integer = 0
        Dim Ende() As Byte = {0, 0, 0, 0}
        While Not (Ende(0) = 254 And Ende(1) = 254 And Ende(2) = 254 And Ende(3) = 254)
            Ende(0) = StrR.ReadByte
            Ende(1) = StrR.ReadByte
            Ende(2) = StrR.ReadByte
            Ende(3) = StrR.ReadByte
            StrR.Seek(-4)
            If Not (Ende(0) = 254 And Ende(1) = 254 And Ende(2) = 254 And Ende(3) = 254) Then
                E.Ladung(Counter) = ObjektEinheit.Read(StrR, Units)
                E.Ladung(Counter).X = E.X
                E.Ladung(Counter).Y = E.Y
                For I = 0 To E.Ladung(Counter).Ladung.Length - 1
                    E.Ladung(Counter).Ladung(I).X = E.X
                    E.Ladung(Counter).Ladung(I).X = E.Y
                Next
                Counter = 0
            End If
        End While
        StrR.ReadByte()
        StrR.ReadByte()
        StrR.ReadByte()
        StrR.ReadByte()
        E.Tarnung = StrR.ReadByte
        Return E
    End Function
    Private Shared Function ReadV4(ByRef StrR As Filestream, ByVal E As ObjektEinheit, ByVal Units As String())
        Dim B(3) As Byte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ATKDEFBoost.X = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ATKDEFBoost.Y = BytesToInt(B)
        E.KannReapariertWerden = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Bewegungsbonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.RadioaktiveVerseuchung = BytesToInt(B)
        E.Feldtarnung = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.BesetzungsBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ReichweitenBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.SichtBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.TreibstoffSenkung = BytesToInt(B)
        E.AIUse = StrR.ReadByte
        Dim Counter As Integer = 0
        Dim Ende() As Byte = {0, 0, 0, 0}
        While Not (Ende(0) = 254 And Ende(1) = 254 And Ende(2) = 254 And Ende(3) = 254)
            Ende(0) = StrR.ReadByte
            Ende(1) = StrR.ReadByte
            Ende(2) = StrR.ReadByte
            Ende(3) = StrR.ReadByte
            StrR.Seek(-4)
            If Not (Ende(0) = 254 And Ende(1) = 254 And Ende(2) = 254 And Ende(3) = 254) Then
                E.Ladung(Counter) = ObjektEinheit.Read(StrR, Units)
                E.Ladung(Counter).X = E.X
                E.Ladung(Counter).Y = E.Y
                For I = 0 To E.Ladung(Counter).Ladung.Length - 1
                    E.Ladung(Counter).Ladung(I).X = E.X
                    E.Ladung(Counter).Ladung(I).X = E.Y
                Next
                Counter = 0
            End If
        End While
        StrR.ReadByte()
        StrR.ReadByte()
        StrR.ReadByte()
        StrR.ReadByte()
        E.Besetzung = StrR.ReadByte
        E.TruppenStufe = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Leben = BytesToSingle(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Sprit = BytesToInt(B)
        E.Muni = StrR.ReadByte
        Return E
    End Function
    Private Shared Function ReadV5(ByRef StrR As Filestream, ByVal E As ObjektEinheit, ByVal Units As String())
        Dim B(3) As Byte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ATKDEFBoost.X = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ATKDEFBoost.Y = BytesToInt(B)
        E.KannReapariertWerden = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Bewegungsbonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.RadioaktiveVerseuchung = BytesToInt(B)
        E.Feldtarnung = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.BesetzungsBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ReichweitenBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.SichtBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.TreibstoffSenkung = BytesToInt(B)
        E.AIUse = StrR.ReadByte
        Dim Counter As Integer = 0
        Dim Ende() As Byte = {0, 0, 0, 0}
        While Not (Ende(0) = 254 And Ende(1) = 254 And Ende(2) = 254 And Ende(3) = 254)
            Ende(0) = StrR.ReadByte
            Ende(1) = StrR.ReadByte
            Ende(2) = StrR.ReadByte
            Ende(3) = StrR.ReadByte
            StrR.Seek(-4)
            If Not (Ende(0) = 254 And Ende(1) = 254 And Ende(2) = 254 And Ende(3) = 254) Then
                E.Ladung(Counter) = ObjektEinheit.Read(StrR, Units)
                E.Ladung(Counter).X = E.X
                E.Ladung(Counter).Y = E.Y
                For I = 0 To E.Ladung(Counter).Ladung.Length - 1
                    E.Ladung(Counter).Ladung(I).X = E.X
                    E.Ladung(Counter).Ladung(I).X = E.Y
                Next
                Counter = 0
            End If
        End While
        StrR.ReadByte()
        StrR.ReadByte()
        StrR.ReadByte()
        StrR.ReadByte()
        E.Besetzung = StrR.ReadByte
        Return E
    End Function
    Private Shared Function ReadV6(ByRef StrR As Filestream, ByVal E As ObjektEinheit, ByVal Units As String())
        Dim B(3) As Byte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ATKDEFBoost.X = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ATKDEFBoost.Y = BytesToInt(B)
        E.KannReapariertWerden = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Bewegungsbonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.RadioaktiveVerseuchung = BytesToInt(B)
        E.Feldtarnung = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.BesetzungsBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ReichweitenBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.SichtBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.TreibstoffSenkung = BytesToInt(B)
        E.AIUse = StrR.ReadByte
        Dim Counter As Integer = 0
        Dim Ende() As Byte = {0, 0, 0, 0}
        While Not (Ende(0) = 254 And Ende(1) = 254 And Ende(2) = 254 And Ende(3) = 254)
            Ende(0) = StrR.ReadByte
            Ende(1) = StrR.ReadByte
            Ende(2) = StrR.ReadByte
            Ende(3) = StrR.ReadByte
            StrR.Seek(-4)
            If Not (Ende(0) = 254 And Ende(1) = 254 And Ende(2) = 254 And Ende(3) = 254) Then
                E.Ladung(Counter) = ObjektEinheit.Read(StrR, Units)
                E.Ladung(Counter).X = E.X
                E.Ladung(Counter).Y = E.Y
                For I = 0 To E.Ladung(Counter).Ladung.Length - 1
                    E.Ladung(Counter).Ladung(I).X = E.X
                    E.Ladung(Counter).Ladung(I).X = E.Y
                Next
                Counter = 0
            End If
        End While
        StrR.ReadByte()
        StrR.ReadByte()
        StrR.ReadByte()
        StrR.ReadByte()
        E.TruppenStufe = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Leben = BytesToSingle(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Sprit = BytesToInt(B)
        E.Muni = StrR.ReadByte
        Return E
    End Function
    Private Shared Function ReadV7(ByRef StrR As Filestream, ByVal E As ObjektEinheit, ByVal Units As String())
        Dim B(3) As Byte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ATKDEFBoost.X = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ATKDEFBoost.Y = BytesToInt(B)
        E.KannReapariertWerden = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Bewegungsbonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.RadioaktiveVerseuchung = BytesToInt(B)
        E.Feldtarnung = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.BesetzungsBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ReichweitenBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.SichtBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.TreibstoffSenkung = BytesToInt(B)
        E.AIUse = StrR.ReadByte
        Dim Counter As Integer = 0
        Dim Ende() As Byte = {0, 0, 0, 0}
        While Not (Ende(0) = 254 And Ende(1) = 254 And Ende(2) = 254 And Ende(3) = 254)
            Ende(0) = StrR.ReadByte
            Ende(1) = StrR.ReadByte
            Ende(2) = StrR.ReadByte
            Ende(3) = StrR.ReadByte
            StrR.Seek(-4)
            If Not (Ende(0) = 254 And Ende(1) = 254 And Ende(2) = 254 And Ende(3) = 254) Then
                E.Ladung(Counter) = ObjektEinheit.Read(StrR, Units)
                E.Ladung(Counter).X = E.X
                E.Ladung(Counter).Y = E.Y
                For I = 0 To E.Ladung(Counter).Ladung.Length - 1
                    E.Ladung(Counter).Ladung(I).X = E.X
                    E.Ladung(Counter).Ladung(I).X = E.Y
                Next
                Counter = 0
            End If
        End While
        StrR.ReadByte()
        StrR.ReadByte()
        StrR.ReadByte()
        StrR.ReadByte()
        Return E
    End Function
    Private Shared Function ReadV8(ByRef StrR As Filestream, ByVal E As ObjektEinheit, ByVal Units As String())
        Dim B(3) As Byte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ATKDEFBoost.X = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ATKDEFBoost.Y = BytesToInt(B)
        E.KannReapariertWerden = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Bewegungsbonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.RadioaktiveVerseuchung = BytesToInt(B)
        E.Feldtarnung = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.BesetzungsBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ReichweitenBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.SichtBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.TreibstoffSenkung = BytesToInt(B)
        E.AIUse = StrR.ReadByte
        E.Tarnung = StrR.ReadByte
        E.Besetzung = StrR.ReadByte
        E.TruppenStufe = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Leben = BytesToSingle(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Sprit = BytesToInt(B)
        E.Muni = StrR.ReadByte
        Return E
    End Function
    Private Shared Function ReadV9(ByRef StrR As Filestream, ByVal E As ObjektEinheit, ByVal Units As String())
        Dim B(3) As Byte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ATKDEFBoost.X = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ATKDEFBoost.Y = BytesToInt(B)
        E.KannReapariertWerden = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Bewegungsbonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.RadioaktiveVerseuchung = BytesToInt(B)
        E.Feldtarnung = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.BesetzungsBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ReichweitenBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.SichtBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.TreibstoffSenkung = BytesToInt(B)
        E.AIUse = StrR.ReadByte
        E.Tarnung = StrR.ReadByte
        E.Besetzung = StrR.ReadByte
        Return E
    End Function
    Private Shared Function ReadV10(ByRef StrR As Filestream, ByVal E As ObjektEinheit, ByVal Units As String())
        Dim B(3) As Byte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ATKDEFBoost.X = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ATKDEFBoost.Y = BytesToInt(B)
        E.KannReapariertWerden = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Bewegungsbonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.RadioaktiveVerseuchung = BytesToInt(B)
        E.Feldtarnung = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.BesetzungsBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ReichweitenBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.SichtBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.TreibstoffSenkung = BytesToInt(B)
        E.AIUse = StrR.ReadByte
        E.Tarnung = StrR.ReadByte
        E.TruppenStufe = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Leben = BytesToSingle(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Sprit = BytesToInt(B)
        E.Muni = StrR.ReadByte
        Return E
    End Function
    Private Shared Function ReadV11(ByRef StrR As Filestream, ByVal E As ObjektEinheit, ByVal Units As String())
        Dim B(3) As Byte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ATKDEFBoost.X = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ATKDEFBoost.Y = BytesToInt(B)
        E.KannReapariertWerden = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Bewegungsbonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.RadioaktiveVerseuchung = BytesToInt(B)
        E.Feldtarnung = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.BesetzungsBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ReichweitenBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.SichtBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.TreibstoffSenkung = BytesToInt(B)
        E.AIUse = StrR.ReadByte
        E.Tarnung = StrR.ReadByte
        Return E
    End Function
    Private Shared Function ReadV12(ByRef StrR As Filestream, ByVal E As ObjektEinheit, ByVal Units As String())
        Dim B(3) As Byte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ATKDEFBoost.X = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ATKDEFBoost.Y = BytesToInt(B)
        E.KannReapariertWerden = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Bewegungsbonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.RadioaktiveVerseuchung = BytesToInt(B)
        E.Feldtarnung = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.BesetzungsBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ReichweitenBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.SichtBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.TreibstoffSenkung = BytesToInt(B)
        E.AIUse = StrR.ReadByte
        E.Besetzung = StrR.ReadByte
        E.TruppenStufe = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Leben = BytesToSingle(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Sprit = BytesToInt(B)
        E.Muni = StrR.ReadByte
        Return E
    End Function
    Private Shared Function ReadV13(ByRef StrR As Filestream, ByVal E As ObjektEinheit, ByVal Units As String())
        Dim B(3) As Byte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ATKDEFBoost.X = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ATKDEFBoost.Y = BytesToInt(B)
        E.KannReapariertWerden = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Bewegungsbonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.RadioaktiveVerseuchung = BytesToInt(B)
        E.Feldtarnung = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.BesetzungsBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ReichweitenBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.SichtBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.TreibstoffSenkung = BytesToInt(B)
        E.AIUse = StrR.ReadByte
        E.Besetzung = StrR.ReadByte
        Return E
    End Function
    Private Shared Function ReadV14(ByRef StrR As Filestream, ByVal E As ObjektEinheit, ByVal Units As String())
        Dim B(3) As Byte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ATKDEFBoost.X = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ATKDEFBoost.Y = BytesToInt(B)
        E.KannReapariertWerden = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Bewegungsbonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.RadioaktiveVerseuchung = BytesToInt(B)
        E.Feldtarnung = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.BesetzungsBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ReichweitenBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.SichtBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.TreibstoffSenkung = BytesToInt(B)
        E.AIUse = StrR.ReadByte
        E.TruppenStufe = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Leben = BytesToSingle(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Sprit = BytesToInt(B)
        E.Muni = StrR.ReadByte
        Return E
    End Function
    Private Shared Function ReadV15(ByRef StrR As Filestream, ByVal E As ObjektEinheit, ByVal Units As String())
        Dim B(3) As Byte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ATKDEFBoost.X = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ATKDEFBoost.Y = BytesToInt(B)
        E.KannReapariertWerden = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Bewegungsbonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.RadioaktiveVerseuchung = BytesToInt(B)
        E.Feldtarnung = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.BesetzungsBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ReichweitenBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.SichtBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.TreibstoffSenkung = BytesToInt(B)
        E.AIUse = StrR.ReadByte
        Return E
    End Function
    Private Shared Function ReadV16(ByRef StrR As Filestream, ByVal E As ObjektEinheit, ByVal Units As String())
        Dim B(3) As Byte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ATKDEFBoost.X = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ATKDEFBoost.Y = BytesToInt(B)
        E.KannReapariertWerden = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Bewegungsbonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.RadioaktiveVerseuchung = BytesToInt(B)
        E.Feldtarnung = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.BesetzungsBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ReichweitenBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.SichtBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.TreibstoffSenkung = BytesToInt(B)
        Dim Counter As Integer = 0
        Dim Ende() As Byte = {0, 0, 0, 0}
        While Not (Ende(0) = 254 And Ende(1) = 254 And Ende(2) = 254 And Ende(3) = 254)
            Ende(0) = StrR.ReadByte
            Ende(1) = StrR.ReadByte
            Ende(2) = StrR.ReadByte
            Ende(3) = StrR.ReadByte
            StrR.Seek(-4)
            If Not (Ende(0) = 254 And Ende(1) = 254 And Ende(2) = 254 And Ende(3) = 254) Then
                E.Ladung(Counter) = ObjektEinheit.Read(StrR, Units)
                E.Ladung(Counter).X = E.X
                E.Ladung(Counter).Y = E.Y
                For I = 0 To E.Ladung(Counter).Ladung.Length - 1
                    E.Ladung(Counter).Ladung(I).X = E.X
                    E.Ladung(Counter).Ladung(I).X = E.Y
                Next
                Counter = 0
            End If
        End While
        StrR.ReadByte()
        StrR.ReadByte()
        StrR.ReadByte()
        StrR.ReadByte()
        E.Tarnung = StrR.ReadByte
        E.Besetzung = StrR.ReadByte
        E.TruppenStufe = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Leben = BytesToSingle(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Sprit = BytesToInt(B)
        E.Muni = StrR.ReadByte
        Return E
    End Function
    Private Shared Function ReadV17(ByRef StrR As Filestream, ByVal E As ObjektEinheit, ByVal Units As String())
        Dim B(3) As Byte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ATKDEFBoost.X = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ATKDEFBoost.Y = BytesToInt(B)
        E.KannReapariertWerden = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Bewegungsbonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.RadioaktiveVerseuchung = BytesToInt(B)
        E.Feldtarnung = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.BesetzungsBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ReichweitenBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.SichtBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.TreibstoffSenkung = BytesToInt(B)
        Dim Counter As Integer = 0
        Dim Ende() As Byte = {0, 0, 0, 0}
        While Not (Ende(0) = 254 And Ende(1) = 254 And Ende(2) = 254 And Ende(3) = 254)
            Ende(0) = StrR.ReadByte
            Ende(1) = StrR.ReadByte
            Ende(2) = StrR.ReadByte
            Ende(3) = StrR.ReadByte
            StrR.Seek(-4)
            If Not (Ende(0) = 254 And Ende(1) = 254 And Ende(2) = 254 And Ende(3) = 254) Then
                E.Ladung(Counter) = ObjektEinheit.Read(StrR, Units)
                E.Ladung(Counter).X = E.X
                E.Ladung(Counter).Y = E.Y
                For I = 0 To E.Ladung(Counter).Ladung.Length - 1
                    E.Ladung(Counter).Ladung(I).X = E.X
                    E.Ladung(Counter).Ladung(I).X = E.Y
                Next
                Counter = 0
            End If
        End While
        StrR.ReadByte()
        StrR.ReadByte()
        StrR.ReadByte()
        StrR.ReadByte()
        E.Tarnung = StrR.ReadByte
        E.Besetzung = StrR.ReadByte
        Return E
    End Function
    Private Shared Function ReadV18(ByRef StrR As Filestream, ByVal E As ObjektEinheit, ByVal Units As String())
        Dim B(3) As Byte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ATKDEFBoost.X = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ATKDEFBoost.Y = BytesToInt(B)
        E.KannReapariertWerden = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Bewegungsbonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.RadioaktiveVerseuchung = BytesToInt(B)
        E.Feldtarnung = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.BesetzungsBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ReichweitenBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.SichtBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.TreibstoffSenkung = BytesToInt(B)
        Dim Counter As Integer = 0
        Dim Ende() As Byte = {0, 0, 0, 0}
        While Not (Ende(0) = 254 And Ende(1) = 254 And Ende(2) = 254 And Ende(3) = 254)
            Ende(0) = StrR.ReadByte
            Ende(1) = StrR.ReadByte
            Ende(2) = StrR.ReadByte
            Ende(3) = StrR.ReadByte
            StrR.Seek(-4)
            If Not (Ende(0) = 254 And Ende(1) = 254 And Ende(2) = 254 And Ende(3) = 254) Then
                E.Ladung(Counter) = ObjektEinheit.Read(StrR, Units)
                E.Ladung(Counter).X = E.X
                E.Ladung(Counter).Y = E.Y
                For I = 0 To E.Ladung(Counter).Ladung.Length - 1
                    E.Ladung(Counter).Ladung(I).X = E.X
                    E.Ladung(Counter).Ladung(I).X = E.Y
                Next
                Counter = 0
            End If
        End While
        StrR.ReadByte()
        StrR.ReadByte()
        StrR.ReadByte()
        StrR.ReadByte()
        E.Tarnung = StrR.ReadByte
        E.TruppenStufe = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Leben = BytesToSingle(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Sprit = BytesToInt(B)
        E.Muni = StrR.ReadByte
        Return E
    End Function
    Private Shared Function ReadV19(ByRef StrR As Filestream, ByVal E As ObjektEinheit, ByVal Units As String())
        Dim B(3) As Byte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ATKDEFBoost.X = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ATKDEFBoost.Y = BytesToInt(B)
        E.KannReapariertWerden = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Bewegungsbonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.RadioaktiveVerseuchung = BytesToInt(B)
        E.Feldtarnung = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.BesetzungsBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ReichweitenBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.SichtBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.TreibstoffSenkung = BytesToInt(B)
        Dim Counter As Integer = 0
        Dim Ende() As Byte = {0, 0, 0, 0}
        While Not (Ende(0) = 254 And Ende(1) = 254 And Ende(2) = 254 And Ende(3) = 254)
            Ende(0) = StrR.ReadByte
            Ende(1) = StrR.ReadByte
            Ende(2) = StrR.ReadByte
            Ende(3) = StrR.ReadByte
            StrR.Seek(-4)
            If Not (Ende(0) = 254 And Ende(1) = 254 And Ende(2) = 254 And Ende(3) = 254) Then
                E.Ladung(Counter) = ObjektEinheit.Read(StrR, Units)
                E.Ladung(Counter).X = E.X
                E.Ladung(Counter).Y = E.Y
                For I = 0 To E.Ladung(Counter).Ladung.Length - 1
                    E.Ladung(Counter).Ladung(I).X = E.X
                    E.Ladung(Counter).Ladung(I).X = E.Y
                Next
                Counter = 0
            End If
        End While
        StrR.ReadByte()
        StrR.ReadByte()
        StrR.ReadByte()
        StrR.ReadByte()
        E.Tarnung = StrR.ReadByte
        Return E
    End Function
    Private Shared Function ReadV20(ByRef StrR As Filestream, ByVal E As ObjektEinheit, ByVal Units As String())
        Dim B(3) As Byte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ATKDEFBoost.X = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ATKDEFBoost.Y = BytesToInt(B)
        E.KannReapariertWerden = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Bewegungsbonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.RadioaktiveVerseuchung = BytesToInt(B)
        E.Feldtarnung = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.BesetzungsBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ReichweitenBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.SichtBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.TreibstoffSenkung = BytesToInt(B)
        Dim Counter As Integer = 0
        Dim Ende() As Byte = {0, 0, 0, 0}
        While Not (Ende(0) = 254 And Ende(1) = 254 And Ende(2) = 254 And Ende(3) = 254)
            Ende(0) = StrR.ReadByte
            Ende(1) = StrR.ReadByte
            Ende(2) = StrR.ReadByte
            Ende(3) = StrR.ReadByte
            StrR.Seek(-4)
            If Not (Ende(0) = 254 And Ende(1) = 254 And Ende(2) = 254 And Ende(3) = 254) Then
                E.Ladung(Counter) = ObjektEinheit.Read(StrR, Units)
                E.Ladung(Counter).X = E.X
                E.Ladung(Counter).Y = E.Y
                For I = 0 To E.Ladung(Counter).Ladung.Length - 1
                    E.Ladung(Counter).Ladung(I).X = E.X
                    E.Ladung(Counter).Ladung(I).X = E.Y
                Next
                Counter = 0
            End If
        End While
        StrR.ReadByte()
        StrR.ReadByte()
        StrR.ReadByte()
        StrR.ReadByte()
        E.Besetzung = StrR.ReadByte
        E.TruppenStufe = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Leben = BytesToSingle(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Sprit = BytesToInt(B)
        E.Muni = StrR.ReadByte
        Return E
    End Function
    Private Shared Function ReadV21(ByRef StrR As Filestream, ByVal E As ObjektEinheit, ByVal Units As String())
        Dim B(3) As Byte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ATKDEFBoost.X = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ATKDEFBoost.Y = BytesToInt(B)
        E.KannReapariertWerden = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Bewegungsbonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.RadioaktiveVerseuchung = BytesToInt(B)
        E.Feldtarnung = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.BesetzungsBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ReichweitenBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.SichtBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.TreibstoffSenkung = BytesToInt(B)
        Dim Counter As Integer = 0
        Dim Ende() As Byte = {0, 0, 0, 0}
        While Not (Ende(0) = 254 And Ende(1) = 254 And Ende(2) = 254 And Ende(3) = 254)
            Ende(0) = StrR.ReadByte
            Ende(1) = StrR.ReadByte
            Ende(2) = StrR.ReadByte
            Ende(3) = StrR.ReadByte
            StrR.Seek(-4)
            If Not (Ende(0) = 254 And Ende(1) = 254 And Ende(2) = 254 And Ende(3) = 254) Then
                E.Ladung(Counter) = ObjektEinheit.Read(StrR, Units)
                E.Ladung(Counter).X = E.X
                E.Ladung(Counter).Y = E.Y
                For I = 0 To E.Ladung(Counter).Ladung.Length - 1
                    E.Ladung(Counter).Ladung(I).X = E.X
                    E.Ladung(Counter).Ladung(I).X = E.Y
                Next
                Counter = 0
            End If
        End While
        StrR.ReadByte()
        StrR.ReadByte()
        StrR.ReadByte()
        StrR.ReadByte()
        E.Besetzung = StrR.ReadByte
        Return E
    End Function
    Private Shared Function ReadV22(ByRef StrR As Filestream, ByVal E As ObjektEinheit, ByVal Units As String())
        Dim B(3) As Byte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ATKDEFBoost.X = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ATKDEFBoost.Y = BytesToInt(B)
        E.KannReapariertWerden = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Bewegungsbonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.RadioaktiveVerseuchung = BytesToInt(B)
        E.Feldtarnung = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.BesetzungsBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ReichweitenBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.SichtBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.TreibstoffSenkung = BytesToInt(B)
        Dim Counter As Integer = 0
        Dim Ende() As Byte = {0, 0, 0, 0}
        While Not (Ende(0) = 254 And Ende(1) = 254 And Ende(2) = 254 And Ende(3) = 254)
            Ende(0) = StrR.ReadByte
            Ende(1) = StrR.ReadByte
            Ende(2) = StrR.ReadByte
            Ende(3) = StrR.ReadByte
            StrR.Seek(-4)
            If Not (Ende(0) = 254 And Ende(1) = 254 And Ende(2) = 254 And Ende(3) = 254) Then
                E.Ladung(Counter) = ObjektEinheit.Read(StrR, Units)
                E.Ladung(Counter).X = E.X
                E.Ladung(Counter).Y = E.Y
                For I = 0 To E.Ladung(Counter).Ladung.Length - 1
                    E.Ladung(Counter).Ladung(I).X = E.X
                    E.Ladung(Counter).Ladung(I).X = E.Y
                Next
                Counter = 0
            End If
        End While
        StrR.ReadByte()
        StrR.ReadByte()
        StrR.ReadByte()
        StrR.ReadByte()
        E.TruppenStufe = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Leben = BytesToSingle(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Sprit = BytesToInt(B)
        E.Muni = StrR.ReadByte
        Return E
    End Function
    Private Shared Function ReadV23(ByRef StrR As Filestream, ByVal E As ObjektEinheit, ByVal Units As String())
        Dim B(3) As Byte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ATKDEFBoost.X = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ATKDEFBoost.Y = BytesToInt(B)
        E.KannReapariertWerden = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Bewegungsbonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.RadioaktiveVerseuchung = BytesToInt(B)
        E.Feldtarnung = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.BesetzungsBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ReichweitenBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.SichtBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.TreibstoffSenkung = BytesToInt(B)
        Dim Counter As Integer = 0
        Dim Ende() As Byte = {0, 0, 0, 0}
        While Not (Ende(0) = 254 And Ende(1) = 254 And Ende(2) = 254 And Ende(3) = 254)
            Ende(0) = StrR.ReadByte
            Ende(1) = StrR.ReadByte
            Ende(2) = StrR.ReadByte
            Ende(3) = StrR.ReadByte
            StrR.Seek(-4)
            If Not (Ende(0) = 254 And Ende(1) = 254 And Ende(2) = 254 And Ende(3) = 254) Then
                E.Ladung(Counter) = ObjektEinheit.Read(StrR, Units)
                E.Ladung(Counter).X = E.X
                E.Ladung(Counter).Y = E.Y
                For I = 0 To E.Ladung(Counter).Ladung.Length - 1
                    E.Ladung(Counter).Ladung(I).X = E.X
                    E.Ladung(Counter).Ladung(I).X = E.Y
                Next
                Counter = 0
            End If
        End While
        StrR.ReadByte()
        StrR.ReadByte()
        StrR.ReadByte()
        StrR.ReadByte()
        Return E
    End Function
    Private Shared Function ReadV24(ByRef StrR As Filestream, ByVal E As ObjektEinheit, ByVal Units As String())
        Dim B(3) As Byte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ATKDEFBoost.X = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ATKDEFBoost.Y = BytesToInt(B)
        E.KannReapariertWerden = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Bewegungsbonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.RadioaktiveVerseuchung = BytesToInt(B)
        E.Feldtarnung = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.BesetzungsBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ReichweitenBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.SichtBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.TreibstoffSenkung = BytesToInt(B)
        E.Tarnung = StrR.ReadByte
        E.Besetzung = StrR.ReadByte
        E.TruppenStufe = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Leben = BytesToSingle(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Sprit = BytesToInt(B)
        E.Muni = StrR.ReadByte
        Return E
    End Function
    Private Shared Function ReadV25(ByRef StrR As Filestream, ByVal E As ObjektEinheit, ByVal Units As String())
        Dim B(3) As Byte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ATKDEFBoost.X = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ATKDEFBoost.Y = BytesToInt(B)
        E.KannReapariertWerden = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Bewegungsbonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.RadioaktiveVerseuchung = BytesToInt(B)
        E.Feldtarnung = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.BesetzungsBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ReichweitenBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.SichtBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.TreibstoffSenkung = BytesToInt(B)
        E.Tarnung = StrR.ReadByte
        E.Besetzung = StrR.ReadByte
        Return E
    End Function
    Private Shared Function ReadV26(ByRef StrR As Filestream, ByVal E As ObjektEinheit, ByVal Units As String())
        Dim B(3) As Byte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ATKDEFBoost.X = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ATKDEFBoost.Y = BytesToInt(B)
        E.KannReapariertWerden = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Bewegungsbonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.RadioaktiveVerseuchung = BytesToInt(B)
        E.Feldtarnung = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.BesetzungsBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ReichweitenBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.SichtBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.TreibstoffSenkung = BytesToInt(B)
        E.Tarnung = StrR.ReadByte
        E.TruppenStufe = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Leben = BytesToSingle(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Sprit = BytesToInt(B)
        E.Muni = StrR.ReadByte
        Return E
    End Function
    Private Shared Function ReadV27(ByRef StrR As Filestream, ByVal E As ObjektEinheit, ByVal Units As String())
        Dim B(3) As Byte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ATKDEFBoost.X = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ATKDEFBoost.Y = BytesToInt(B)
        E.KannReapariertWerden = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Bewegungsbonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.RadioaktiveVerseuchung = BytesToInt(B)
        E.Feldtarnung = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.BesetzungsBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ReichweitenBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.SichtBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.TreibstoffSenkung = BytesToInt(B)
        E.Tarnung = StrR.ReadByte
        Return E
    End Function
    Private Shared Function ReadV28(ByRef StrR As Filestream, ByVal E As ObjektEinheit, ByVal Units As String())
        Dim B(3) As Byte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ATKDEFBoost.X = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ATKDEFBoost.Y = BytesToInt(B)
        E.KannReapariertWerden = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Bewegungsbonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.RadioaktiveVerseuchung = BytesToInt(B)
        E.Feldtarnung = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.BesetzungsBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ReichweitenBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.SichtBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.TreibstoffSenkung = BytesToInt(B)
        E.Besetzung = StrR.ReadByte
        E.TruppenStufe = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Leben = BytesToSingle(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Sprit = BytesToInt(B)
        E.Muni = StrR.ReadByte
        Return E
    End Function
    Private Shared Function ReadV29(ByRef StrR As Filestream, ByVal E As ObjektEinheit, ByVal Units As String())
        Dim B(3) As Byte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ATKDEFBoost.X = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ATKDEFBoost.Y = BytesToInt(B)
        E.KannReapariertWerden = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Bewegungsbonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.RadioaktiveVerseuchung = BytesToInt(B)
        E.Feldtarnung = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.BesetzungsBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ReichweitenBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.SichtBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.TreibstoffSenkung = BytesToInt(B)
        E.Besetzung = StrR.ReadByte
        Return E
    End Function
    Private Shared Function ReadV30(ByRef StrR As Filestream, ByVal E As ObjektEinheit, ByVal Units As String())
        Dim B(3) As Byte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ATKDEFBoost.X = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ATKDEFBoost.Y = BytesToInt(B)
        E.KannReapariertWerden = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Bewegungsbonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.RadioaktiveVerseuchung = BytesToInt(B)
        E.Feldtarnung = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.BesetzungsBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ReichweitenBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.SichtBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.TreibstoffSenkung = BytesToInt(B)
        E.TruppenStufe = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Leben = BytesToSingle(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Sprit = BytesToInt(B)
        E.Muni = StrR.ReadByte
        Return E
    End Function
    Private Shared Function ReadV31(ByRef StrR As Filestream, ByVal E As ObjektEinheit, ByVal Units As String())
        Dim B(3) As Byte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ATKDEFBoost.X = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ATKDEFBoost.Y = BytesToInt(B)
        E.KannReapariertWerden = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Bewegungsbonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.RadioaktiveVerseuchung = BytesToInt(B)
        E.Feldtarnung = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.BesetzungsBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.ReichweitenBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.SichtBonus = BytesToInt(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.TreibstoffSenkung = BytesToInt(B)
        Return E
    End Function
    Private Shared Function ReadV32(ByRef StrR As Filestream, ByVal E As ObjektEinheit, ByVal Units As String())
        Dim B(3) As Byte
        E.AIUse = StrR.ReadByte
        Dim Counter As Integer = 0
        Dim Ende() As Byte = {0, 0, 0, 0}
        While Not (Ende(0) = 254 And Ende(1) = 254 And Ende(2) = 254 And Ende(3) = 254)
            Ende(0) = StrR.ReadByte
            Ende(1) = StrR.ReadByte
            Ende(2) = StrR.ReadByte
            Ende(3) = StrR.ReadByte
            StrR.Seek(-4)
            If Not (Ende(0) = 254 And Ende(1) = 254 And Ende(2) = 254 And Ende(3) = 254) Then
                E.Ladung(Counter) = ObjektEinheit.Read(StrR, Units)
                E.Ladung(Counter).X = E.X
                E.Ladung(Counter).Y = E.Y
                For I = 0 To E.Ladung(Counter).Ladung.Length - 1
                    E.Ladung(Counter).Ladung(I).X = E.X
                    E.Ladung(Counter).Ladung(I).X = E.Y
                Next
                Counter = 0
            End If
        End While
        StrR.ReadByte()
        StrR.ReadByte()
        StrR.ReadByte()
        StrR.ReadByte()
        E.Tarnung = StrR.ReadByte
        E.Besetzung = StrR.ReadByte
        E.TruppenStufe = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Leben = BytesToSingle(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Sprit = BytesToInt(B)
        E.Muni = StrR.ReadByte
        Return E
    End Function
    Private Shared Function ReadV33(ByRef StrR As Filestream, ByVal E As ObjektEinheit, ByVal Units As String())
        E.AIUse = StrR.ReadByte
        Dim Counter As Integer = 0
        Dim Ende() As Byte = {0, 0, 0, 0}
        While Not (Ende(0) = 254 And Ende(1) = 254 And Ende(2) = 254 And Ende(3) = 254)
            Ende(0) = StrR.ReadByte
            Ende(1) = StrR.ReadByte
            Ende(2) = StrR.ReadByte
            Ende(3) = StrR.ReadByte
            StrR.Seek(-4)
            If Not (Ende(0) = 254 And Ende(1) = 254 And Ende(2) = 254 And Ende(3) = 254) Then
                E.Ladung(Counter) = ObjektEinheit.Read(StrR, Units)
                E.Ladung(Counter).X = E.X
                E.Ladung(Counter).Y = E.Y
                For I = 0 To E.Ladung(Counter).Ladung.Length - 1
                    E.Ladung(Counter).Ladung(I).X = E.X
                    E.Ladung(Counter).Ladung(I).X = E.Y
                Next
                Counter = 0
            End If
        End While
        StrR.ReadByte()
        StrR.ReadByte()
        StrR.ReadByte()
        StrR.ReadByte()
        E.Tarnung = StrR.ReadByte
        E.Besetzung = StrR.ReadByte
        Return E
    End Function
    Private Shared Function ReadV34(ByRef StrR As Filestream, ByVal E As ObjektEinheit, ByVal Units As String())
        Dim B(3) As Byte
        E.AIUse = StrR.ReadByte
        Dim Counter As Integer = 0
        Dim Ende() As Byte = {0, 0, 0, 0}
        While Not (Ende(0) = 254 And Ende(1) = 254 And Ende(2) = 254 And Ende(3) = 254)
            Ende(0) = StrR.ReadByte
            Ende(1) = StrR.ReadByte
            Ende(2) = StrR.ReadByte
            Ende(3) = StrR.ReadByte
            StrR.Seek(-4)
            If Not (Ende(0) = 254 And Ende(1) = 254 And Ende(2) = 254 And Ende(3) = 254) Then
                E.Ladung(Counter) = ObjektEinheit.Read(StrR, Units)
                E.Ladung(Counter).X = E.X
                E.Ladung(Counter).Y = E.Y
                For I = 0 To E.Ladung(Counter).Ladung.Length - 1
                    E.Ladung(Counter).Ladung(I).X = E.X
                    E.Ladung(Counter).Ladung(I).X = E.Y
                Next
                Counter = 0
            End If
        End While
        StrR.ReadByte()
        StrR.ReadByte()
        StrR.ReadByte()
        StrR.ReadByte()
        E.Tarnung = StrR.ReadByte
        E.TruppenStufe = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Leben = BytesToSingle(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Sprit = BytesToInt(B)
        E.Muni = StrR.ReadByte
        Return E
    End Function
    Private Shared Function ReadV35(ByRef StrR As Filestream, ByVal E As ObjektEinheit, ByVal Units As String())
        E.AIUse = StrR.ReadByte
        Dim Counter As Integer = 0
        Dim Ende() As Byte = {0, 0, 0, 0}
        While Not (Ende(0) = 254 And Ende(1) = 254 And Ende(2) = 254 And Ende(3) = 254)
            Ende(0) = StrR.ReadByte
            Ende(1) = StrR.ReadByte
            Ende(2) = StrR.ReadByte
            Ende(3) = StrR.ReadByte
            StrR.Seek(-4)
            If Not (Ende(0) = 254 And Ende(1) = 254 And Ende(2) = 254 And Ende(3) = 254) Then
                E.Ladung(Counter) = ObjektEinheit.Read(StrR, Units)
                E.Ladung(Counter).X = E.X
                E.Ladung(Counter).Y = E.Y
                For I = 0 To E.Ladung(Counter).Ladung.Length - 1
                    E.Ladung(Counter).Ladung(I).X = E.X
                    E.Ladung(Counter).Ladung(I).X = E.Y
                Next
                Counter = 0
            End If
        End While
        StrR.ReadByte()
        StrR.ReadByte()
        StrR.ReadByte()
        StrR.ReadByte()
        E.Tarnung = StrR.ReadByte
        Return E
    End Function
    Private Shared Function ReadV36(ByRef StrR As Filestream, ByVal E As ObjektEinheit, ByVal Units As String())
        Dim B(3) As Byte
        E.AIUse = StrR.ReadByte
        Dim Counter As Integer = 0
        Dim Ende() As Byte = {0, 0, 0, 0}
        While Not (Ende(0) = 254 And Ende(1) = 254 And Ende(2) = 254 And Ende(3) = 254)
            Ende(0) = StrR.ReadByte
            Ende(1) = StrR.ReadByte
            Ende(2) = StrR.ReadByte
            Ende(3) = StrR.ReadByte
            StrR.Seek(-4)
            If Not (Ende(0) = 254 And Ende(1) = 254 And Ende(2) = 254 And Ende(3) = 254) Then
                E.Ladung(Counter) = ObjektEinheit.Read(StrR, Units)
                E.Ladung(Counter).X = E.X
                E.Ladung(Counter).Y = E.Y
                For I = 0 To E.Ladung(Counter).Ladung.Length - 1
                    E.Ladung(Counter).Ladung(I).X = E.X
                    E.Ladung(Counter).Ladung(I).X = E.Y
                Next
                Counter = 0
            End If
        End While
        StrR.ReadByte()
        StrR.ReadByte()
        StrR.ReadByte()
        StrR.ReadByte()
        E.Besetzung = StrR.ReadByte
        E.TruppenStufe = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Leben = BytesToSingle(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Sprit = BytesToInt(B)
        E.Muni = StrR.ReadByte
        Return E
    End Function
    Private Shared Function ReadV37(ByRef StrR As Filestream, ByVal E As ObjektEinheit, ByVal Units As String())
        E.AIUse = StrR.ReadByte
        Dim Counter As Integer = 0
        Dim Ende() As Byte = {0, 0, 0, 0}
        While Not (Ende(0) = 254 And Ende(1) = 254 And Ende(2) = 254 And Ende(3) = 254)
            Ende(0) = StrR.ReadByte
            Ende(1) = StrR.ReadByte
            Ende(2) = StrR.ReadByte
            Ende(3) = StrR.ReadByte
            StrR.Seek(-4)
            If Not (Ende(0) = 254 And Ende(1) = 254 And Ende(2) = 254 And Ende(3) = 254) Then
                E.Ladung(Counter) = ObjektEinheit.Read(StrR, Units)
                E.Ladung(Counter).X = E.X
                E.Ladung(Counter).Y = E.Y
                For I = 0 To E.Ladung(Counter).Ladung.Length - 1
                    E.Ladung(Counter).Ladung(I).X = E.X
                    E.Ladung(Counter).Ladung(I).X = E.Y
                Next
                Counter = 0
            End If
        End While
        StrR.ReadByte()
        StrR.ReadByte()
        StrR.ReadByte()
        StrR.ReadByte()
        E.Besetzung = StrR.ReadByte
        Return E
    End Function
    Private Shared Function ReadV38(ByRef StrR As Filestream, ByVal E As ObjektEinheit, ByVal Units As String())
        Dim B(3) As Byte
        E.AIUse = StrR.ReadByte
        Dim Counter As Integer = 0
        Dim Ende() As Byte = {0, 0, 0, 0}
        While Not (Ende(0) = 254 And Ende(1) = 254 And Ende(2) = 254 And Ende(3) = 254)
            Ende(0) = StrR.ReadByte
            Ende(1) = StrR.ReadByte
            Ende(2) = StrR.ReadByte
            Ende(3) = StrR.ReadByte
            StrR.Seek(-4)
            If Not (Ende(0) = 254 And Ende(1) = 254 And Ende(2) = 254 And Ende(3) = 254) Then
                E.Ladung(Counter) = ObjektEinheit.Read(StrR, Units)
                E.Ladung(Counter).X = E.X
                E.Ladung(Counter).Y = E.Y
                For I = 0 To E.Ladung(Counter).Ladung.Length - 1
                    E.Ladung(Counter).Ladung(I).X = E.X
                    E.Ladung(Counter).Ladung(I).X = E.Y
                Next
                Counter = 0
            End If
        End While
        StrR.ReadByte()
        StrR.ReadByte()
        StrR.ReadByte()
        StrR.ReadByte()
        E.TruppenStufe = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Leben = BytesToSingle(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Sprit = BytesToInt(B)
        E.Muni = StrR.ReadByte
        Return E
    End Function
    Private Shared Function ReadV39(ByRef StrR As Filestream, ByVal E As ObjektEinheit, ByVal Units As String())
        E.AIUse = StrR.ReadByte
        Dim Counter As Integer = 0
        Dim Ende() As Byte = {0, 0, 0, 0}
        While Not (Ende(0) = 254 And Ende(1) = 254 And Ende(2) = 254 And Ende(3) = 254)
            Ende(0) = StrR.ReadByte
            Ende(1) = StrR.ReadByte
            Ende(2) = StrR.ReadByte
            Ende(3) = StrR.ReadByte
            StrR.Seek(-4)
            If Not (Ende(0) = 254 And Ende(1) = 254 And Ende(2) = 254 And Ende(3) = 254) Then
                E.Ladung(Counter) = ObjektEinheit.Read(StrR, Units)
                E.Ladung(Counter).X = E.X
                E.Ladung(Counter).Y = E.Y
                For I = 0 To E.Ladung(Counter).Ladung.Length - 1
                    E.Ladung(Counter).Ladung(I).X = E.X
                    E.Ladung(Counter).Ladung(I).X = E.Y
                Next
                Counter = 0
            End If
        End While
        StrR.ReadByte()
        StrR.ReadByte()
        StrR.ReadByte()
        StrR.ReadByte()
        Return E
    End Function
    Private Shared Function ReadV40(ByRef StrR As Filestream, ByVal E As ObjektEinheit, ByVal Units As String())
        Dim B(3) As Byte
        E.AIUse = StrR.ReadByte
        E.Tarnung = StrR.ReadByte
        E.Besetzung = StrR.ReadByte
        E.TruppenStufe = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Leben = BytesToSingle(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Sprit = BytesToInt(B)
        E.Muni = StrR.ReadByte
        Return E
    End Function
    Private Shared Function ReadV41(ByRef StrR As Filestream, ByVal E As ObjektEinheit, ByVal Units As String())
        E.AIUse = StrR.ReadByte
        E.Tarnung = StrR.ReadByte
        E.Besetzung = StrR.ReadByte
        Return E
    End Function
    Private Shared Function ReadV42(ByRef StrR As Filestream, ByVal E As ObjektEinheit, ByVal Units As String())
        Dim B(3) As Byte
        E.AIUse = StrR.ReadByte
        E.Tarnung = StrR.ReadByte
        E.TruppenStufe = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Leben = BytesToSingle(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Sprit = BytesToInt(B)
        E.Muni = StrR.ReadByte
        Return E
    End Function
    Private Shared Function ReadV43(ByRef StrR As Filestream, ByVal E As ObjektEinheit, ByVal Units As String())
        E.AIUse = StrR.ReadByte
        E.Tarnung = StrR.ReadByte
        Return E
    End Function
    Private Shared Function ReadV44(ByRef StrR As Filestream, ByVal E As ObjektEinheit, ByVal Units As String())
        Dim B(3) As Byte
        E.AIUse = StrR.ReadByte
        E.Besetzung = StrR.ReadByte
        E.TruppenStufe = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Leben = BytesToSingle(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Sprit = BytesToInt(B)
        E.Muni = StrR.ReadByte
        Return E
    End Function
    Private Shared Function ReadV45(ByRef StrR As Filestream, ByVal E As ObjektEinheit, ByVal Units As String())
        E.AIUse = StrR.ReadByte
        E.Besetzung = StrR.ReadByte
        Return E
    End Function
    Private Shared Function ReadV46(ByRef StrR As Filestream, ByVal E As ObjektEinheit, ByVal Units As String())
        Dim B(3) As Byte
        E.AIUse = StrR.ReadByte
        E.TruppenStufe = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Leben = BytesToSingle(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Sprit = BytesToInt(B)
        E.Muni = StrR.ReadByte
        Return E
    End Function
    Private Shared Function ReadV47(ByRef StrR As Filestream, ByVal E As ObjektEinheit, ByVal Units As String())
        E.AIUse = StrR.ReadByte
        Return E
    End Function
    Private Shared Function ReadV48(ByRef StrR As Filestream, ByVal E As ObjektEinheit, ByVal Units As String())
        Dim B(3) As Byte
        Dim Counter As Integer = 0
        Dim Ende() As Byte = {0, 0, 0, 0}
        While Not (Ende(0) = 254 And Ende(1) = 254 And Ende(2) = 254 And Ende(3) = 254)
            Ende(0) = StrR.ReadByte
            Ende(1) = StrR.ReadByte
            Ende(2) = StrR.ReadByte
            Ende(3) = StrR.ReadByte
            StrR.Seek(-4)
            If Not (Ende(0) = 254 And Ende(1) = 254 And Ende(2) = 254 And Ende(3) = 254) Then
                E.Ladung(Counter) = ObjektEinheit.Read(StrR, Units)
                E.Ladung(Counter).X = E.X
                E.Ladung(Counter).Y = E.Y
                For I = 0 To E.Ladung(Counter).Ladung.Length - 1
                    E.Ladung(Counter).Ladung(I).X = E.X
                    E.Ladung(Counter).Ladung(I).X = E.Y
                Next
                Counter = 0
            End If
        End While
        StrR.ReadByte()
        StrR.ReadByte()
        StrR.ReadByte()
        StrR.ReadByte()
        E.Tarnung = StrR.ReadByte
        E.Besetzung = StrR.ReadByte
        E.TruppenStufe = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Leben = BytesToSingle(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Sprit = BytesToInt(B)
        E.Muni = StrR.ReadByte
        Return E
    End Function
    Private Shared Function ReadV49(ByRef StrR As Filestream, ByVal E As ObjektEinheit, ByVal Units As String())
        Dim Counter As Integer = 0
        Dim Ende() As Byte = {0, 0, 0, 0}
        While Not (Ende(0) = 254 And Ende(1) = 254 And Ende(2) = 254 And Ende(3) = 254)
            Ende(0) = StrR.ReadByte
            Ende(1) = StrR.ReadByte
            Ende(2) = StrR.ReadByte
            Ende(3) = StrR.ReadByte
            StrR.Seek(-4)
            If Not (Ende(0) = 254 And Ende(1) = 254 And Ende(2) = 254 And Ende(3) = 254) Then
                E.Ladung(Counter) = ObjektEinheit.Read(StrR, Units)
                E.Ladung(Counter).X = E.X
                E.Ladung(Counter).Y = E.Y
                For I = 0 To E.Ladung(Counter).Ladung.Length - 1
                    E.Ladung(Counter).Ladung(I).X = E.X
                    E.Ladung(Counter).Ladung(I).X = E.Y
                Next
                Counter = 0
            End If
        End While
        StrR.ReadByte()
        StrR.ReadByte()
        StrR.ReadByte()
        StrR.ReadByte()
        E.Tarnung = StrR.ReadByte
        E.Besetzung = StrR.ReadByte
        Return E
    End Function
    Private Shared Function ReadV50(ByRef StrR As Filestream, ByVal E As ObjektEinheit, ByVal Units As String())
        Dim B(3) As Byte
        Dim Counter As Integer = 0
        Dim Ende() As Byte = {0, 0, 0, 0}
        While Not (Ende(0) = 254 And Ende(1) = 254 And Ende(2) = 254 And Ende(3) = 254)
            Ende(0) = StrR.ReadByte
            Ende(1) = StrR.ReadByte
            Ende(2) = StrR.ReadByte
            Ende(3) = StrR.ReadByte
            StrR.Seek(-4)
            If Not (Ende(0) = 254 And Ende(1) = 254 And Ende(2) = 254 And Ende(3) = 254) Then
                E.Ladung(Counter) = ObjektEinheit.Read(StrR, Units)
                E.Ladung(Counter).X = E.X
                E.Ladung(Counter).Y = E.Y
                For I = 0 To E.Ladung(Counter).Ladung.Length - 1
                    E.Ladung(Counter).Ladung(I).X = E.X
                    E.Ladung(Counter).Ladung(I).X = E.Y
                Next
                Counter = 0
            End If
        End While
        StrR.ReadByte()
        StrR.ReadByte()
        StrR.ReadByte()
        StrR.ReadByte()
        E.Tarnung = StrR.ReadByte
        E.TruppenStufe = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Leben = BytesToSingle(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Sprit = BytesToInt(B)
        E.Muni = StrR.ReadByte
        Return E
    End Function
    Private Shared Function ReadV51(ByRef StrR As Filestream, ByVal E As ObjektEinheit, ByVal Units As String())
        Dim Counter As Integer = 0
        Dim Ende() As Byte = {0, 0, 0, 0}
        While Not (Ende(0) = 254 And Ende(1) = 254 And Ende(2) = 254 And Ende(3) = 254)
            Ende(0) = StrR.ReadByte
            Ende(1) = StrR.ReadByte
            Ende(2) = StrR.ReadByte
            Ende(3) = StrR.ReadByte
            StrR.Seek(-4)
            If Not (Ende(0) = 254 And Ende(1) = 254 And Ende(2) = 254 And Ende(3) = 254) Then
                E.Ladung(Counter) = ObjektEinheit.Read(StrR, Units)
                E.Ladung(Counter).X = E.X
                E.Ladung(Counter).Y = E.Y
                For I = 0 To E.Ladung(Counter).Ladung.Length - 1
                    E.Ladung(Counter).Ladung(I).X = E.X
                    E.Ladung(Counter).Ladung(I).X = E.Y
                Next
                Counter = 0
            End If
        End While
        StrR.ReadByte()
        StrR.ReadByte()
        StrR.ReadByte()
        StrR.ReadByte()
        E.Tarnung = StrR.ReadByte
        Return E
    End Function
    Private Shared Function ReadV52(ByRef StrR As Filestream, ByVal E As ObjektEinheit, ByVal Units As String())
        Dim B(3) As Byte
        Dim Counter As Integer = 0
        Dim Ende() As Byte = {0, 0, 0, 0}
        While Not (Ende(0) = 254 And Ende(1) = 254 And Ende(2) = 254 And Ende(3) = 254)
            Ende(0) = StrR.ReadByte
            Ende(1) = StrR.ReadByte
            Ende(2) = StrR.ReadByte
            Ende(3) = StrR.ReadByte
            StrR.Seek(-4)
            If Not (Ende(0) = 254 And Ende(1) = 254 And Ende(2) = 254 And Ende(3) = 254) Then
                E.Ladung(Counter) = ObjektEinheit.Read(StrR, Units)
                E.Ladung(Counter).X = E.X
                E.Ladung(Counter).Y = E.Y
                For I = 0 To E.Ladung(Counter).Ladung.Length - 1
                    E.Ladung(Counter).Ladung(I).X = E.X
                    E.Ladung(Counter).Ladung(I).X = E.Y
                Next
                Counter = 0
            End If
        End While
        StrR.ReadByte()
        StrR.ReadByte()
        StrR.ReadByte()
        StrR.ReadByte()
        E.Besetzung = StrR.ReadByte
        E.TruppenStufe = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Leben = BytesToSingle(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Sprit = BytesToInt(B)
        E.Muni = StrR.ReadByte
        Return E
    End Function
    Private Shared Function ReadV53(ByRef StrR As Filestream, ByVal E As ObjektEinheit, ByVal Units As String())
        Dim Counter As Integer = 0
        Dim Ende() As Byte = {0, 0, 0, 0}
        While Not (Ende(0) = 254 And Ende(1) = 254 And Ende(2) = 254 And Ende(3) = 254)
            Ende(0) = StrR.ReadByte
            Ende(1) = StrR.ReadByte
            Ende(2) = StrR.ReadByte
            Ende(3) = StrR.ReadByte
            StrR.Seek(-4)
            If Not (Ende(0) = 254 And Ende(1) = 254 And Ende(2) = 254 And Ende(3) = 254) Then
                E.Ladung(Counter) = ObjektEinheit.Read(StrR, Units)
                E.Ladung(Counter).X = E.X
                E.Ladung(Counter).Y = E.Y
                For I = 0 To E.Ladung(Counter).Ladung.Length - 1
                    E.Ladung(Counter).Ladung(I).X = E.X
                    E.Ladung(Counter).Ladung(I).X = E.Y
                Next
                Counter = 0
            End If
        End While
        StrR.ReadByte()
        StrR.ReadByte()
        StrR.ReadByte()
        StrR.ReadByte()
        E.Besetzung = StrR.ReadByte
        Return E
    End Function
    Private Shared Function ReadV54(ByRef StrR As Filestream, ByVal E As ObjektEinheit, ByVal Units As String())
        Dim B(3) As Byte
        Dim Counter As Integer = 0
        Dim Ende() As Byte = {0, 0, 0, 0}
        While Not (Ende(0) = 254 And Ende(1) = 254 And Ende(2) = 254 And Ende(3) = 254)
            Ende(0) = StrR.ReadByte
            Ende(1) = StrR.ReadByte
            Ende(2) = StrR.ReadByte
            Ende(3) = StrR.ReadByte
            StrR.Seek(-4)
            If Not (Ende(0) = 254 And Ende(1) = 254 And Ende(2) = 254 And Ende(3) = 254) Then
                E.Ladung(Counter) = ObjektEinheit.Read(StrR, Units)
                E.Ladung(Counter).X = E.X
                E.Ladung(Counter).Y = E.Y
                For I = 0 To E.Ladung(Counter).Ladung.Length - 1
                    E.Ladung(Counter).Ladung(I).X = E.X
                    E.Ladung(Counter).Ladung(I).X = E.Y
                Next
                Counter = 0
            End If
        End While
        StrR.ReadByte()
        StrR.ReadByte()
        StrR.ReadByte()
        StrR.ReadByte()
        E.TruppenStufe = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Leben = BytesToSingle(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Sprit = BytesToInt(B)
        E.Muni = StrR.ReadByte
        Return E
    End Function
    Private Shared Function ReadV55(ByRef StrR As Filestream, ByVal E As ObjektEinheit, ByVal Units As String())
        Dim Counter As Integer = 0
        Dim Ende() As Byte = {0, 0, 0, 0}
        While Not (Ende(0) = 254 And Ende(1) = 254 And Ende(2) = 254 And Ende(3) = 254)
            Ende(0) = StrR.ReadByte
            Ende(1) = StrR.ReadByte
            Ende(2) = StrR.ReadByte
            Ende(3) = StrR.ReadByte
            StrR.Seek(-4)
            If Not (Ende(0) = 254 And Ende(1) = 254 And Ende(2) = 254 And Ende(3) = 254) Then
                E.Ladung(Counter) = ObjektEinheit.Read(StrR, Units)
                E.Ladung(Counter).X = E.X
                E.Ladung(Counter).Y = E.Y
                For I = 0 To E.Ladung(Counter).Ladung.Length - 1
                    E.Ladung(Counter).Ladung(I).X = E.X
                    E.Ladung(Counter).Ladung(I).X = E.Y
                Next
                Counter = 0
            End If
        End While
        StrR.ReadByte()
        StrR.ReadByte()
        StrR.ReadByte()
        StrR.ReadByte()
        Return E
    End Function
    Private Shared Function ReadV56(ByRef StrR As Filestream, ByVal E As ObjektEinheit, ByVal Units As String())
        Dim B(3) As Byte
        E.Tarnung = StrR.ReadByte
        E.Besetzung = StrR.ReadByte
        E.TruppenStufe = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Leben = BytesToSingle(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Sprit = BytesToInt(B)
        E.Muni = StrR.ReadByte
        Return E
    End Function
    Private Shared Function ReadV57(ByRef StrR As Filestream, ByVal E As ObjektEinheit, ByVal Units As String())
        E.Tarnung = StrR.ReadByte
        E.Besetzung = StrR.ReadByte
        Return E
    End Function
    Private Shared Function ReadV58(ByRef StrR As Filestream, ByVal E As ObjektEinheit, ByVal Units As String())
        Dim B(3) As Byte
        E.Tarnung = StrR.ReadByte
        E.TruppenStufe = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Leben = BytesToSingle(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Sprit = BytesToInt(B)
        E.Muni = StrR.ReadByte
        Return E
    End Function
    Private Shared Function ReadV59(ByRef StrR As Filestream, ByVal E As ObjektEinheit, ByVal Units As String())
        E.Tarnung = StrR.ReadByte
        Return E
    End Function
    Private Shared Function ReadV60(ByRef StrR As Filestream, ByVal E As ObjektEinheit, ByVal Units As String())
        Dim B(3) As Byte
        E.Besetzung = StrR.ReadByte
        E.TruppenStufe = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Leben = BytesToSingle(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Sprit = BytesToInt(B)
        E.Muni = StrR.ReadByte
        Return E
    End Function
    Private Shared Function ReadV61(ByRef StrR As Filestream, ByVal E As ObjektEinheit, ByVal Units As String())
        E.Besetzung = StrR.ReadByte
        Return E
    End Function
    Private Shared Function ReadV62(ByRef StrR As Filestream, ByVal E As ObjektEinheit, ByVal Units As String())
        Dim B(3) As Byte
        E.TruppenStufe = StrR.ReadByte
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Leben = BytesToSingle(B)
        For I = 0 To B.Length - 1
            B(I) = StrR.ReadByte()
        Next
        E.Sprit = BytesToInt(B)
        E.Muni = StrR.ReadByte
        Return E
    End Function
    Private Shared Function ReadV63(ByRef StrR As Filestream, ByVal E As ObjektEinheit, ByVal Units As String())
        Return E
    End Function
#End Region
#End Region
#Region "Funktionen"
    Public Function Get_Unit_Space() As Integer
        Select Case DataSettings.CommanderWarsGameModus
            Case CommanderWarsGameModi.CommanderWars2
                If Bewegungsarte = MovementSorts.Fuss.ToString Or Bewegungsarte = MovementSorts.Mech.ToString Then
                    Return Unit_Space
                ElseIf Koste <= Unit_Heavy_Price Then
                    Return Unit_Space * 2
                Else
                    Return Unit_Space * 3
                End If
            Case Else
                Return 1
        End Select
    End Function

    Public Sub setRotation(ByVal Richtung As Richtungen)
        Rotation = Math.PI / 2 * Richtung
    End Sub
    Public Function getPosArt() As ObjektLandschaftsTextur.Positionsarten
        Return ObjektLandschaftsTextur.Positionsarten.Boden
    End Function
    Public Sub DoDamage(ByVal TP As Integer)
        Leben -= (TP * 10)
        If Leben <= 0 Then Leben = 1
        If Leben > 100 Then Leben = 100
    End Sub
    Public Function IsInFirerange(ByVal Einheit As ObjektEinheit) As Boolean
        Dim Distance As Integer = Math.Abs(X - Einheit.X) + Math.Abs(Einheit.Y - Y)
        If Distance >= MinimaleReichweite And Distance <= MaximaleReichweite Then
            Return True
        Else
            Return False
        End If
    End Function
    ''' <summary>
    ''' Wir geben zurueck ob die Einheit den Gegner angreifen koennte.
    ''' </summary>
    ''' <param name="Gegner"></param>
    ''' <param name="MitMuni"></param>
    ''' <param name="MitTarnung">wenn true, wird beruecksichtigt, ob die Einheit den Gegner sieht</param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function IsAttackable(ByVal Gegner As ObjektEinheit, ByVal MitMuni As Boolean, Optional ByVal MitTarnung As Boolean = True) As Boolean
        If Not Gegner Is Nothing Then
            If Gegner.GetTarnung Then
                If Gegner.Bewegungsart <> Bewegungsart Then
                    Return False
                End If
            End If
            If Objektverwalter.Spielfeld.Spieler(Gegner.Spieler).Team <> Objektverwalter.Spielfeld.Spieler(Spieler).Team Then
                If MitTarnung Then
                    If Not Gegner.isSichtbar(Me) Then Return False
                End If
                If Tabellenverwalter.GetWert(Waffe1, Gegner.EinheitenID) > 0 Then
                    Return True
                ElseIf MitMuni = True And Muni > 0 Then
                    If Tabellenverwalter.GetWert(Waffe2, Gegner.EinheitenID) > 0 Then
                        Return True
                    Else
                        Return False
                    End If
                ElseIf MitMuni = False And Tabellenverwalter.GetWert(Waffe2, Gegner.EinheitenID) > 0 Then
                    Return True
                Else
                    Return False
                End If

            End If
        End If
        Return False
    End Function
    ''' <summary>
    ''' Wir geben zurueck ob die Einheit den Gegner angreifen koennte.
    ''' </summary>
    ''' <param name="Gegner"></param>
    ''' <param name="MitMuni"></param>
    ''' <param name="MitTarnung"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function GetDamage(ByVal Gegner As ObjektEinheit, ByVal MitMuni As Boolean, Optional ByVal MitTarnung As Boolean = True) As Integer()
        If Not Gegner Is Nothing Then

            If Objektverwalter.Spielfeld.Spieler(Gegner.Spieler).Team <> Objektverwalter.Spielfeld.Spieler(Spieler).Team Then
                If MitTarnung Then
                    If Not Gegner.isSichtbar(Me) Then Return New Integer() {-1, -1}
                End If
                Dim W1 As Integer = Tabellenverwalter.GetWert(Waffe1, Gegner.EinheitenID)
                Dim W2 As Integer = -1
                If (MitMuni = True And Muni > 0) Or Not MitMuni Then
                    W2 = Tabellenverwalter.GetWert(Waffe2, Gegner.EinheitenID)
                End If
                If W1 >= 0 Or W2 >= 0 Then
                    If W1 >= W2 Then
                        Return New Integer() {W1, 1}
                    Else
                        Return New Integer() {W2, 2}
                    End If
                End If
            End If
        End If
        Return New Integer() {-1, -1}
    End Function
    ''' <summary>
    ''' Gibt zurueck, ob die Einheit vom Aktuellen Spieler gesehen werden kann. Hierbei ist die KI mit dem Mensch gleichberechtigt :)
    ''' </summary>
    ''' <param name="Spaeher">Es wird ueberprueft, ob der Besitzer dieser Einheit, der aktuelle Spieler ist.</param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function isSichtbar(ByVal Spaeher As ObjektEinheit) As Boolean
        Return isSichtbar(Objektverwalter.Spielfeld.Spieler(Spaeher.Spieler).Team)
    End Function
    Public Function isSichtbar(ByVal Team As Char) As Boolean
        If GetSpieler.Team = Team Then Return True
        If Team = Objektverwalter.Spielfeld.AktuellerSpieler.Team Then 'Ansonsten kann ich das leider nicht machen!
            If Me IsNot Nothing Then
                If Objektverwalter.Spielfeld.AktuellerSpieler.KIStufe = ObjektSpieler.KIStufen.Mensch Then
                    If Not Sichtbar Then
                        Return False
                    End If
                Else
                    If Objektverwalter.Spielfeld.CurrentAI IsNot Nothing Then
                        If Objektverwalter.Spielfeld.CurrentAI.Sichtfeld(X, Y, ObjektKI.Schlachtfeld) = False Then
                            Return False
                        End If
                    End If
                End If
            End If
        Else
            If DurchSichtfeldSichtbar(Team) Then
                Return True
            Else
                If ((IsGetarnt(Team) Or (Objektverwalter.Spielfeld.Landschaften(X, Y, GetMap).Tarnung And Objektverwalter.Spielfeld.Regeln.Nebel > Nebelarten.Aus And (Not IsFlyingUnit()))) And Not GetSpieler.KOS(0).RiffWaldSchauer) Then
                    Dim L As ObjektLandschaft
                    L = Wegsuchsystem.getFeldRundrum(X, Y, GetMap, 1, 1, Nothing, Objektverwalter.Spielfeld)
                    Do Until L Is Nothing
                        Dim E As ObjektEinheit = Objektverwalter.Spielfeld.Einheiten(L.KooX, L.KooY, GetMap)
                        If E IsNot Nothing Then
                            If E.GetSpieler.Team = Team Then
                                Return True
                            End If
                        End If
                        L = Wegsuchsystem.getFeldRundrum(X, Y, GetMap, 1, 1, L, Objektverwalter.Spielfeld)
                    Loop
                    Return False
                Else
                    If Objektverwalter.Spielfeld.Regeln.Nebel > Nebelarten.Aus Then
                        Dim Schlacht As Integer = GetMap()
                        For X1 = 0 To Objektverwalter.Spielfeld.Breite - 1
                            For Y1 = 0 To Objektverwalter.Spielfeld.Hoehe - 1
                                Dim E As ObjektEinheit = Objektverwalter.Spielfeld.Einheiten(X1, Y1, Schlacht)
                                If E IsNot Nothing Then
                                    If E.GetSpieler.Team = Team Then
                                        If E.GetDistance(Me) <= E.GetSicht Then
                                            Return True
                                        End If
                                    End If
                                End If
                                Dim L As ObjektLandschaft = Objektverwalter.Spielfeld.Landschaften(X1, Y1, Schlacht)
                                If L.LandschaftsID = "FEUER" Then
                                    If Me.GetDistance(New Point(X1, Y1)) <= LandschaftsTexturFeuer.FeuerSicht Then
                                        Return True
                                    End If
                                ElseIf L.Gebaeude IsNot Nothing Then
                                    If L.Gebaeude.Angriff = ObjektGebaeude.Angriffe.Radar Then
                                        If Me.GetDistance(New Point(X1, Y1)) <= L.Gebaeude.Reichweite Then
                                            Return True
                                        End If
                                    End If
                                End If
                            Next
                        Next
                        Return False
                    Else
                        Return True
                    End If
                End If
            End If
            Return False
        End If
        Return True
    End Function
    Public Function DurchSichtfeldSichtbar(ByVal Spieler As Integer) As Boolean
        Return DurchSichtfeldSichtbar(Objektverwalter.Spielfeld.Spieler(Spieler).Team)
    End Function
    Public Function DurchSichtfeldSichtbar(ByVal Team As Char) As Boolean
        For S = 1 To Objektverwalter.Spielfeld.Spieler.Length - 1
            If Objektverwalter.Spielfeld.Spieler(S).Team = Team Then
                For i = 0 To Objektverwalter.Spielfeld.Spieler(S).Sichtfelder.Length - 1
                    If Objektverwalter.Spielfeld.Spieler(S).Sichtfelder(i).Z = GetMap() Then
                        If GetDistance(New Point(Objektverwalter.Spielfeld.Spieler(S).Sichtfelder(i).X, Objektverwalter.Spielfeld.Spieler(S).Sichtfelder(i).Y)) <= Objektverwalter.Spielfeld.Spieler(S).Sichtfelder(i).W Then
                            Return True
                        End If
                    End If
                Next
            End If
        Next
        Return False
    End Function
    ''' <summary>
    ''' Gibt zurueck ob die Einheit von dieser als Fracht aufgenommen werden kann.
    ''' </summary>
    ''' <param name="Einheit"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function IsLoadable(ByVal Einheit As ObjektEinheit) As Boolean
        If Ladung IsNot Nothing Then
            If Ladung.Length > 0 And GeladeneEinheitenIDs IsNot Nothing Then
                For I = 0 To GeladeneEinheitenIDs.Length - 1
                    If GeladeneEinheitenIDs(I) = Einheit.EinheitenID Then
                        Dim NumberOfLoadedUnits As Integer = 0
                        For Each E In Ladung
                            If E Is Nothing Then
                                'NumberOfLoadedUnits += E.Get_Unit_Space()
                                If NumberOfLoadedUnits < Ladung.Length Then
                                    Return True
                                Else
                                    Return False
                                End If
                            Else
                                NumberOfLoadedUnits += E.Get_Unit_Space()
                            End If
                        Next
                    End If
                Next
                Return False
            Else
                Return False
            End If
        End If
        Return False
    End Function
    ''' <summary>
    ''' Ueberprueft ob von diesem Feld aus 
    ''' </summary>
    ''' <param name="X"></param>
    ''' <param name="Y"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function IsLoadingUnderground(ByVal X As Integer, ByVal Y As Integer) As Boolean
        Dim LandschaftsID As String = Objektverwalter.Spielfeld.Landschaften(X, Y, Me.GetMap).getID
        For Each ID In EntladungsUntergrund
            If ID = LandschaftsID Then
                Return True
            End If
        Next
        Return False
    End Function
    ''' <summary>
    ''' Gibt den Grundschaden zurueck, welchen diese Einheit dem Gegner bei einem Angriff zufuegen wuerde.
    ''' </summary>
    ''' <param name="Gegner"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function GetGroundDamage(ByVal Gegner As ObjektEinheit, ByVal MitMuni As Boolean) As Integer
        Dim S1 As Integer = Tabellenverwalter.GetWert(Waffe1, Gegner.EinheitenID)
        Dim S2 As Integer = Tabellenverwalter.GetWert(Waffe2, Gegner.EinheitenID)
        If MitMuni = True Then
            If Muni > 0 Then
                If S2 > S1 Then
                    Return S2
                Else
                    Return S1
                End If
            Else
                Return S1
            End If
        Else
            If S2 > S1 Then
                Return S2
            Else
                Return S1
            End If
        End If
    End Function
    ''' <summary>
    ''' Gibt zurueck ob die Einheit ueber dieses Landschaft laufen kann.
    ''' </summary>
    ''' <param name="X"></param>
    ''' <param name="Y"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function CanMoveOverTile(ByVal X As Integer, ByVal Y As Integer, ByVal Schlacht As Integer) As Boolean
        If Objektverwalter.Spielfeld.OnMap(X, Y) = False Then Return False
        If Tabellenverwalter.GetWert(Bewegungsart + "+Sonne", Objektverwalter.Spielfeld.Landschaften(X, Y, Schlacht).getID) >= 0 Then
            Return True
        Else
            Return False
        End If
    End Function
    ''' <summary>
    ''' Gibt zurueck ob die beiden Einheiten Gegner sind.
    ''' </summary>
    ''' <param name="Einheit"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function IsEnemy(ByVal Einheit As ObjektEinheit) As Boolean
        If Objektverwalter.Spielfeld.Spieler(Spieler).Team <> Objektverwalter.Spielfeld.Spieler(Einheit.Spieler).Team Then
            Return True
        Else
            Return False
        End If
    End Function
    ''' <summary>
    ''' Berechnet die Bewegungspunkte der Einheit bei bestimmten Wetter bei -1 Wetter =Momentanes Wetter!
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function GetMovementRange(Optional ByVal Wetter As ObjektSpielfeld.Wetterarten = -1) As Integer
        If Wetter < 0 Then Wetter = Objektverwalter.Spielfeld.Regeln.Wetter
        Dim TMultiplikator As Integer = GetTreibstoffMultiplikator(Wetter)
        Dim Bew As Integer = Bewegungspunkte
        Dim S As ObjektSpieler = GetSpieler()
        Dim K As ObjektKO = Nothing
        If S IsNot Nothing Then
            If S.KOS IsNot Nothing Then
                K = S.KOS(0)
            End If
        End If
        If K IsNot Nothing Then
            If IsNothing(Objektverwalter.Spielfeld.Spieler(Spieler).KOS(0).Bewegungsbonus) = False Then
                Bew += Objektverwalter.Spielfeld.Spieler(Spieler).KOS(0).Bewegungsbonus.GetWert(EinheitenID) * GetSpieler.KOS(0).GetKOZoneBoost(Me)
            End If
        End If
        If Wetter = ObjektSpielfeld.Wetterarten.Schnee Then
            Select Case DataSettings.CommanderWarsGameModus
                Case CommanderWarsGameModi.AdvanceWarsDC
                    If K IsNot Nothing Then
                        If Not GetSpieler.KOS(0).Wetterimmunitaet.Contains(ObjektSpielfeld.Wetterarten.Schnee) Then
                            'schnee nimmt uns in DC einen Bewegungspunkt weg.
                            'Idioten ich will nicht ich weigere mich
                            'Nuetzt nichts!
                            Bew -= 1
                            If Bew = 0 Then
                                Bew = 1
                            End If
                        End If
                    Else
                        Bew -= 1
                        If Bew = 0 Then
                            Bew = 1
                        End If
                    End If
                Case CommanderWarsGameModi.CommanderWars2
                    If Bewegungsart.ToLower <> "schneeketten" Then 'Schneepanzer sind Immun gegen Schnee!
                        If K IsNot Nothing Then
                            If Not GetSpieler.KOS(0).Wetterimmunitaet.Contains(ObjektSpielfeld.Wetterarten.Schnee) Then
                                'schnee nimmt uns in DC einen Bewegungspunkt weg.
                                'Idioten ich will nicht ich weigere mich
                                'Nuetzt nichts!
                                Bew -= 1
                                If Bew = 0 Then
                                    Bew = 1
                                End If
                            End If
                        Else
                            Bew -= 1
                            If Bew = 0 Then
                                Bew = 1
                            End If
                        End If
                    End If
            End Select
        End If
        If Bew * TMultiplikator > Treibstoff And Treibstoff >= 0 Then
            Bew = Math.DivRem(Treibstoff, TMultiplikator, 0)
        ElseIf Treibstoff < 0 Then
            Bew = Bew
        End If
        Return Bew
    End Function
    ''' <summary>
    ''' Soviel Treibstoff wird mehr verbraucht.
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function GetTreibstoffMultiplikator(Optional ByVal Wetter As ObjektSpielfeld.Wetterarten = -1) As Integer
        If Wetter < 0 Then Wetter = Objektverwalter.Spielfeld.Regeln.Wetter
        Dim TMultiplikator As Integer = 1
        Select Case DataSettings.CommanderWarsGameModus
            Case CommanderWarsGameModi.AdvanceWarsDS, CommanderWarsGameModi.CommanderWars2
                If Wetter = ObjektSpielfeld.Wetterarten.Schnee Then
                    If Bewegungsart.ToLower <> "schneeketten" Then
                        If GetSpieler.KOS(0).Wetterimmunitaet.Contains(ObjektSpielfeld.Wetterarten.Schnee) Then
                            TMultiplikator = 1
                        Else
                            TMultiplikator = 2
                        End If
                    Else
                        TMultiplikator = 1
                    End If
                Else
                    TMultiplikator = 1
                End If
            Case Else
                TMultiplikator = 1

        End Select
        Return TMultiplikator
    End Function
    ''' <summary>
    ''' Ueberprueft ob die Einheit andere Einheiten geladen hat.
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function HasLadung() As Boolean
        For Each E In Ladung
            If Not E Is Nothing Then
                Return True
            End If
        Next
        Return False
    End Function
    Public Function IsLowPowerUnit(ByVal MinimalerTreibstoff As Single, ByVal MinimaleMunition As Single, ByVal MinimaleKP As Integer) As Boolean
        If MinimalerTreibstoff * SpritMax <= Treibstoff Then
            If MinimaleMunition * MunitionMax < Muni Or MunitionMax < 0 Or HasMaterial() Then
                If getKP() >= MinimaleKP Then
                    Return False
                End If
            End If

        End If
        Return True
    End Function
    ''' <summary>
    ''' Gibt zurueck ob die KI die Einheit benutzt
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function IsUsingUnit(ByVal MinimalerTreibstoff As Single, ByVal MinimaleMunition As Single, ByVal MinimaleKP As Integer) As Boolean
        If HatsichBewegt = False Then
            If Leben > 0 Then
                If Treibstoff <> 0 Then
                    If MinimalerTreibstoff * SpritMax <= Treibstoff Then
                        If MinimaleMunition * MunitionMax <= Muni Or MinimaleMunition < 0 Then
                            If getKP() >= MinimaleKP Then
                                Dim S As ObjektSpieler = GetSpieler()
                                For I = 0 To S.ExternGezogeneEinheiten.Length - 1
                                    If Me.Equals(S.ExternGezogeneEinheiten(I).Einheit) Then
                                        Return False
                                    End If
                                Next
                                Return True
                            Else
                                Return False
                            End If
                        Else
                            Return False
                        End If
                    Else
                        'Eigentlich False aber fuer die Tests gerade True!
                        Return False
                    End If
                End If
            End If
        End If
        Return False
    End Function
    ''' <summary>
    ''' Gibt zurueck ob diese Einheit Gebaeude angreifen kann.
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function CanAttackBuilding() As Boolean
        If Tabellenverwalter.GetWert(Waffe1, "Gebaeude") > 0 Then
            Return True
        ElseIf Tabellenverwalter.GetWert(Waffe2, "Gebaeude") > 0 And Munition > 0 Then
            Return True
        Else
            Return False
        End If
    End Function
    ''' <summary>
    ''' Tarnt die Einheit
    ''' </summary>
    ''' <param name="value"></param>
    ''' <remarks></remarks>
    Public Sub SetTarnung(ByVal value As Boolean)
        If KannTarnen = True Then
            Tarnung = value
        Else
            Tarnung = False
        End If
    End Sub
    ''' <summary>
    ''' Gibt zurueck ob die Einheit fuer den Spieler getarnt ist
    ''' </summary>
    ''' <param name="Spieler"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function IsGetarnt(ByVal Spieler As Integer) As Boolean
        If Objektverwalter.Spielfeld.Spieler(Spieler).Team = GetSpieler.Team Then
            Return False
        Else
            If Tarnung = True Then
                Return True
            ElseIf Feldtarnung = True Then
                Return HatFeldTarnung(Spieler)
            Else
                Return False
            End If
        End If
    End Function
    Public Function IsGetarnt(ByVal Team As Char) As Boolean
        If Team = GetSpieler.Team Then
            Return False
        Else
            If Tarnung = True Then
                Return True
            ElseIf Feldtarnung = True Then
                Return HatFeldTarnung(Team)
            Else
                Return False
            End If
        End If
    End Function
    ''' <summary>
    ''' Gibt zurueck ob die Einheit Feldtarnung hat oder nicht.
    ''' </summary>
    ''' <param name="Spieler"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Private Function HatFeldTarnung(ByVal Spieler As Integer) As Boolean
        Dim X2 As Integer = X
        Dim Y2 As Integer = Y
        For I = 0 To 3
            Select Case I
                Case 0
                    X2 -= 1
                Case 1
                    X2 += 1
                    Y2 -= 1
                Case 2
                    X2 += 1
                    Y2 += 1
                Case 3
                    X2 -= 1
                    Y2 += 1
            End Select
            If Objektverwalter.Spielfeld.OnMap(X2, Y2) Then
                If Not Objektverwalter.Spielfeld.Einheiten(X2, Y2, Me.GetMap) Is Nothing Then
                    If Objektverwalter.Spielfeld.Spieler(Objektverwalter.Spielfeld.Einheiten(X2, Y2, Me.GetMap).Spieler).Team = Objektverwalter.Spielfeld.Spieler(Spieler).Team Then
                        Return False
                    End If
                End If
            End If
        Next
        For S = 1 To Objektverwalter.Spielfeld.Spieler.Length - 1
            If Objektverwalter.Spielfeld.Spieler(S).Team = Objektverwalter.Spielfeld.Spieler(Spieler).Team Then
                For i = 0 To Objektverwalter.Spielfeld.Spieler(S).Sichtfelder.Length - 1
                    If Objektverwalter.Spielfeld.Spieler(S).Sichtfelder(i).Z = GetMap() Then
                        If GetDistance(New Point(Objektverwalter.Spielfeld.Spieler(S).Sichtfelder(i).X, Objektverwalter.Spielfeld.Spieler(S).Sichtfelder(i).Y)) <= Objektverwalter.Spielfeld.Spieler(S).Sichtfelder(i).W Then
                            Return False
                        End If
                    End If
                Next
            End If
        Next
        Return True
    End Function
    ''' <summary>
    ''' Gibt zurueck ob die Einheit Feldtarnung hat oder nicht.
    ''' </summary>
    ''' <param name="Team"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Private Function HatFeldTarnung(ByVal Team As Char) As Boolean
        Dim X2 As Integer = X
        Dim Y2 As Integer = Y
        For I = 0 To 3
            Select Case I
                Case 0
                    X2 -= 1
                Case 1
                    X2 += 1
                    Y2 -= 1
                Case 2
                    X2 += 1
                    Y2 += 1
                Case 3
                    X2 -= 1
                    Y2 += 1
            End Select
            If Objektverwalter.Spielfeld.OnMap(X2, Y2) Then
                If Not Objektverwalter.Spielfeld.Einheiten(X2, Y2, Me.GetMap) Is Nothing Then
                    If Team = Objektverwalter.Spielfeld.Spieler(Objektverwalter.Spielfeld.Einheiten(X2, Y2, Me.GetMap).Spieler).Team Then
                        Return False
                    End If
                End If
            End If
        Next
        For S = 1 To Objektverwalter.Spielfeld.Spieler.Length - 1
            If Objektverwalter.Spielfeld.Spieler(S).Team = Team Then
                For i = 0 To Objektverwalter.Spielfeld.Spieler(S).Sichtfelder.Length - 1
                    If Objektverwalter.Spielfeld.Spieler(S).Sichtfelder(i).Z = GetMap() Then
                        If GetDistance(New Point(Objektverwalter.Spielfeld.Spieler(S).Sichtfelder(i).X, Objektverwalter.Spielfeld.Spieler(S).Sichtfelder(i).Y)) <= Objektverwalter.Spielfeld.Spieler(S).Sichtfelder(i).W Then
                            Return False
                        End If
                    End If
                Next
            End If
        Next
        Return True
    End Function
    ''' <summary>
    ''' Gibt zurueck ob die Einheit untergetaucht ist.
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function IsGetaucht() As Boolean
        Return Tarnung
    End Function
    ''' <summary>
    ''' Gibt zurueck ob die Einheit fuer den Spieler getarnt ist
    ''' </summary>
    ''' <param name="Einheit"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function IsGetarnt(ByVal Einheit As ObjektEinheit) As Boolean
        Return IsGetarnt(Einheit.Spieler)
    End Function
    ''' <summary>
    ''' Legt die Feldtarnung der Einheit fest.
    ''' </summary>
    ''' <param name="value"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function SetFeldtarnung(ByVal value As Boolean) As Boolean
        Feldtarnung = value
    End Function
    ''' <summary>
    ''' Gibt die Koordinaten der Einheit zurueck.
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function GetLocation() As Point
        Return New Point(X, Y)
    End Function
    ''' <summary>
    ''' Gibt das Terrain zurueck auf dem diese Einheit steht
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function GetTerrain() As ObjektLandschaft
        If Not Objektverwalter.Spielfeld.Laufen Is Nothing Then
            If Me.Equals(Objektverwalter.Spielfeld.AktuelleEinheit) Then
                Return Objektverwalter.Spielfeld.Landschaften(Objektverwalter.Spielfeld.Laufen.Position.X, Objektverwalter.Spielfeld.Laufen.Position.Y, Me.GetMap)
            Else
                If Me.Equals(Objektverwalter.Spielfeld.Einheiten(X, Y, 0)) Then
                    Return Objektverwalter.Spielfeld.Landschaften(X, Y, 0)
                Else
                    Return Objektverwalter.Spielfeld.Landschaften(X, Y, 1)
                End If
            End If
        Else
            If Me.Equals(Objektverwalter.Spielfeld.Einheiten(X, Y, 0)) Then
                Return Objektverwalter.Spielfeld.Landschaften(X, Y, 0)
            Else
                Return Objektverwalter.Spielfeld.Landschaften(X, Y, 1)
            End If
        End If
    End Function
    Public Function GetTerrain(ByVal Schlacht As Integer) As ObjektLandschaft
        If Not Objektverwalter.Spielfeld.Laufen Is Nothing Then
            If Me.Equals(Objektverwalter.Spielfeld.AktuelleEinheit) Then
                Return Objektverwalter.Spielfeld.Landschaften(Objektverwalter.Spielfeld.Laufen.Position.X, Objektverwalter.Spielfeld.Laufen.Position.Y, Me.GetMap)
            Else
                Return Objektverwalter.Spielfeld.Landschaften(X, Y, Schlacht)
            End If
        Else
            Return Objektverwalter.Spielfeld.Landschaften(X, Y, Schlacht)
        End If
    End Function
    ''' <summary>
    ''' Gibt das Schlachfeld zurueck auf dem die Einheit kaempft.
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function GetMap() As Integer
        If Battlemap < 0 Then
            If Objektverwalter.Spielfeld.OnMap(X, Y) Then
                If Objektverwalter.Spielfeld.Laufen IsNot Nothing Then
                    If Me.Equals(Objektverwalter.Spielfeld.AktuelleEinheit) Then
                        Return Objektverwalter.Spielfeld.MomentaneSchlacht
                    Else
                        If Me.Equals(Objektverwalter.Spielfeld.Einheiten(X, Y, 0)) Then
                            Return 0
                        Else
                            Return 1
                        End If
                    End If
                Else
                    If X < 0 Or Y < 0 Then
                        Return Objektverwalter.Spielfeld.MomentaneSchlacht
                    Else
                        If Me.Equals(Objektverwalter.Spielfeld.Einheiten(X, Y, 0)) Then
                            Return 0
                        Else
                            Return 1
                        End If
                    End If
                End If
            Else
                Return Objektverwalter.Spielfeld.MomentaneSchlacht
            End If
        Else
            Return Battlemap
        End If
    End Function
    ''' <summary>
    ''' Gibt das Schlachfeld zurueck auf dem die Einheit kaempft.
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function GetMap(ByVal Spielfeld As ObjektSpielfeld) As Integer
        If Not Spielfeld.Laufen Is Nothing Then
            If Me.Equals(Spielfeld.AktuelleEinheit) Then
                Return Spielfeld.MomentaneSchlacht
            Else
                If Me.Equals(Spielfeld.Einheiten(X, Y, 0)) Then
                    Return 0
                Else
                    Return 1
                End If
            End If
        Else
            If Me.Equals(Spielfeld.Einheiten(X, Y, 0)) Then
                Return 0
            Else
                Return 1
            End If
        End If
    End Function
    ''' <summary>
    ''' Gibt den Besitzer zurueck.
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function GetSpieler() As ObjektSpieler
        If Spieler <= 0 Then
            If Objektverwalter.Spielfeld Is Nothing Then
                Return Nothing
            Else
                Return Objektverwalter.Spielfeld.Spieler(0)
            End If
        Else
            Return Objektverwalter.Spielfeld.Spieler(Spieler)
        End If
    End Function
    ''' <summary>
    ''' Gibt das Schlachtfeld zurueck auf das die Einheit geschickt werden kann.
    ''' -1=Geht nicht
    ''' 0=Bodenschlacht
    ''' 1=Luftschlacht
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function GetSendeMap() As Integer
        If Objektverwalter.Spielfeld.Regeln.Luftschlacht = True Then
            If Battlemap < 0 Then
                If Bewegungsart.ToUpper = MovementSorts.Flugzeug.ToString.ToUpper Then
                    Dim Karte As Integer = GetMap()
                    If Karte = ObjektSpielfeld.Bodenschlacht Then
                        Karte = ObjektSpielfeld.Luftschlacht
                    Else
                        Karte = ObjektSpielfeld.Bodenschlacht
                    End If
                    If Objektverwalter.Spielfeld.AktuelleEinheit.Equals(Me) Then
                        If Objektverwalter.Spielfeld.Laufen Is Nothing Then
                            If Objektverwalter.Spielfeld.Einheiten(X, Y, Karte) Is Nothing Then
                                Return Karte
                            Else
                                Return -1
                            End If
                        Else
                            If Objektverwalter.Spielfeld.Einheiten(Objektverwalter.Spielfeld.Laufen.Position.X, Objektverwalter.Spielfeld.Laufen.Position.Y, Karte) Is Nothing Then
                                Return Karte
                            Else
                                Return -1
                            End If
                        End If
                    Else
                        If Objektverwalter.Spielfeld.Einheiten(X, Y, Karte) Is Nothing Then
                            Return Karte
                        Else
                            Return -1
                        End If
                    End If
                Else
                    Return -1
                End If
            Else
                Return -1
            End If
        Else
            Return -1
        End If
    End Function
    ''' <summary>
    ''' Ueberprueft ob das hier unsere Position ist.
    ''' </summary>
    ''' <param name="X"></param>
    ''' <param name="Y"></param>
    ''' <param name="Schlachtfeld"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function IsMyPosition(ByVal X As Integer, ByVal Y As Integer, ByVal Schlachtfeld As Integer) As Boolean
        If Me.X = X Then
            If Me.Y = Y Then
                If Schlachtfeld = GetMap() Then
                    Return True
                End If
            End If
        End If
        Return False
    End Function
    ''' <summary>
    ''' Gibt die Waffe zurueck, die bei einem Angriff benutzt bzw. benutzt werden wuerde.
    ''' </summary>
    ''' <param name="Opfer"></param>
    ''' <param name="Fernkampf"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function GetUsingWeapon(ByVal Opfer As ObjektEinheit, ByVal Fernkampf As Boolean) As Integer
        If Not Opfer Is Nothing Then
            Dim S1 As Single = Tabellenverwalter.GetWert(Waffe1, Opfer.EinheitenID)
            If Fernkampf = True Then S1 = -1
            Dim S2 As Single = -1
            If Muni > 0 Then
                S2 = Tabellenverwalter.GetWert(Waffe2, Opfer.EinheitenID)
            End If
            If S1 >= S2 Then
                Return 1
            Else
                Return 2
            End If
        End If
        Return -1
    End Function
    ''' <summary>
    ''' Gibt zurueck ob die Einheit fliegt.
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function IsFlyingUnit() As Boolean
        If Bewegungsart = MovementSorts.Flugzeug.ToString Or Bewegungsart = MovementSorts.Helikopter.ToString Then
            Return True
        ElseIf Explosione.ToLower = "luft" Then
            Return True
        Else
            Return False
        End If
    End Function
    Public Function KannNurFernkampf() As Boolean
        If MinimaleReichweite > 1 And Waffe1 = "Keine" Then
            Return True
        Else
            Return False
        End If
    End Function
    Public Function HasNoWeapons() As Boolean
        If Waffe1 = "Keine" And Waffe2 = "Keine" Then
            Return True
        Else
            Return False
        End If
    End Function
    ''' <summary>
    ''' Berechnet aus Kosten und Leben den Wert der Einheit.
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function GetEinheitenWert() As Integer
        Return (getKP() / 10) * Kosten * GetSpieler.Teurungsrate(Me, Me.X, Me.Y)
    End Function
    ''' <summary>
    ''' Berechnet aus Kosten den Wert der Einheit.
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function GetEinheitenKosten() As Integer
        Return Kosten * GetSpieler.Teurungsrate(Me, Me.X, Me.Y)
    End Function
    Public Function GetKampfanimation() As Objektverwalter.Kampfanimation
        Return Objektverwalter.AlleEinheiten(BildID).GetKampfAnimation(GetSpieler.Armee)
    End Function
    Public Function GetDistance(ByVal Opfer As ObjektEinheit) As Integer
        Dim X As Integer = Me.X
        Dim Y As Integer = Me.Y
        If Objektverwalter.Spielfeld.AktuelleEinheit IsNot Nothing Then
            If Opfer.Equals(Objektverwalter.Spielfeld.AktuelleEinheit) Then
                If Objektverwalter.Spielfeld.Laufen IsNot Nothing Then
                    Opfer.X = Objektverwalter.Spielfeld.Laufen.Position.X
                    Opfer.Y = Objektverwalter.Spielfeld.Laufen.Position.Y
                End If
            Else
                If Objektverwalter.Spielfeld.Laufen IsNot Nothing Then
                    X = Objektverwalter.Spielfeld.Laufen.Position.X
                    Y = Objektverwalter.Spielfeld.Laufen.Position.Y
                End If
            End If
        Else
            If Objektverwalter.Spielfeld.Laufen IsNot Nothing Then
                X = Objektverwalter.Spielfeld.Laufen.Position.X
                Y = Objektverwalter.Spielfeld.Laufen.Position.Y
            End If
        End If
        Return Math.Abs(X - Opfer.X) + Math.Abs(Y - Opfer.Y)
    End Function
    Public Function GetDistance(ByVal P As Point)
        Return Math.Abs(X - P.X) + Math.Abs(Y - P.Y)
    End Function
    ''' <summary>
    ''' Gibt zurueck ob diese Einheit Bodentruppen angreifen kann.
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function CanAttackGroundUnits() As Boolean
        If Tabellenverwalter.GetWert(Waffe1, "KPZ") > 0 Then
            Return True
        ElseIf Muni > 0 Then
            If Tabellenverwalter.GetWert(Waffe2, "KPZ") > 0 Then
                Return True
            Else
                Return False
            End If
        End If
    End Function
    ''' <summary>
    ''' Gibt zurueck ob diese Einheit Seetruppen angreifen kann.
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function CanAttackSeaUnits() As Boolean
        If Tabellenverwalter.GetWert(Waffe1, "KREUZER") > 0 Then
            Return True
        ElseIf Muni > 0 Then
            If Tabellenverwalter.GetWert(Waffe2, "KREUZER") > 0 Then
                Return True
            Else
                Return False
            End If
        End If
    End Function
    ''' <summary>
    ''' Gibt zurueck ob diese Einheit Lufttruppen angreifen kann.
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function CanAttackAirUnits() As Boolean
        If Tabellenverwalter.GetWert(Waffe1, "BOMBER") > 0 Then
            Return True
        ElseIf Muni > 0 Then
            If Tabellenverwalter.GetWert(Waffe2, "BOMBER") > 0 Then
                Return True
            Else
                Return False
            End If
        End If
    End Function
    Public Function HasPlaceforLoading() As Boolean
        For I = 0 To Ladung.Length - 1
            If Ladung(I) Is Nothing Then
                Return True
            End If
        Next
        Return False
    End Function
    Public Function IsFernwaffe() As Boolean
        If MaximaleReichweite > 1 Then
            Return True
        Else
            Return False
        End If
    End Function
    Public Overridable Function GetCWMunition() As Integer
        Return MunitionMax
    End Function
    Public Function HasMaterial() As Boolean
        If Waffen2.StartsWith("Material") Then
            Return True
        ElseIf Waffen2.StartsWith("Material") Then
            Return True
        Else
            Return False
        End If
    End Function
    Public Overloads Function Equals(ByRef obj As ObjektEinheit) As Boolean
        If MyBase.Equals(obj) Then
            Return True
        Else
            If TypeOf obj Is ObjektEinheit Then
                Dim E As ObjektEinheit = obj
                If Not E Is Nothing Then
                    If E.X = X Then
                        If E.Y = Y Then
                            If E.Munition = Munition Then
                                If E.Treibstoff = Treibstoff Then
                                    If E.Tarnung = Tarnung Then
                                        If E.TruppenStufe = TruppenStufe Then
                                            If E.Spieler = Spieler Then
                                                If E.RadioaktiveVerseuchung = RadioaktiveVerseuchung Then
                                                    If E.Leben = Leben Then
                                                        If E.KannReapariertWerden = KannReapariertWerden Then
                                                            If E.EinheitenIDD = EinheitenIDD Then
                                                                'So viele Zufaelle kann es nicht geben! und wenn doch die Chance ist sehr gering!
                                                                obj = Me
                                                                Return True
                                                            End If
                                                        End If
                                                    End If
                                                End If
                                            End If
                                        End If
                                    End If
                                End If
                            End If
                        End If
                    End If
                End If
            End If
        End If
        Return False
    End Function
    ''' <summary>
    ''' Ueberprueft ob eine Einheit angreifen kann, also ob sie eine Waffe hat.
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function CanAttack() As Boolean
        If Waffe1 <> "Keine" Or Waffe2 <> "Keine" Then
            Return True
        Else
            Return False
        End If
    End Function
    ''' <summary>
    ''' Ist es eine Seeeinheit?
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function IsSeaUnit() As Boolean
        If Bewegungsart = MovementSorts.Transport.ToString Then
            Return True
        ElseIf Bewegungsart = MovementSorts.Schiff.ToString Then
            Return True
        ElseIf Explosion.ToLower = "wasser" Then
            Return True
        Else
            Return False
        End If
    End Function
    ''' <summary>
    ''' Ist es eine Bodeneinheit
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function IsGroundUnit() As Boolean
        If Not IsSeaUnit() Then
            If Not IsFlyingUnit() Then
                Return True
            End If
        End If
        If Explosion.ToLower = "land" Then
            Return True
        Else
            Return False
        End If
    End Function
    ''' <summary>
    ''' Wie gross die staerke gegen Luftwaffe ist von -1 bis viel!
    ''' Je groesser desto besser
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function GetAntiAirDamage() As Integer
        Dim S1 As Single = Tabellenverwalter.GetWert(Waffe1, "BOMBER")
        Dim S2 As Single = Tabellenverwalter.GetWert(Waffe2, "BOMBER")
        If S1 >= S2 Then
            Return S1
        Else
            Return S2
        End If
    End Function
    ''' <summary>
    ''' Zaehlt wie viele Einheiten es von diesem Typ auf der Karte von Besitzer dieses Spielers gibt!
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function CountUnits() As Integer
        If Objektverwalter.Spielfeld Is Nothing Then Return 0
        Dim S As Integer = Spieler
        If S <= 0 Then S = Objektverwalter.Spielfeld.AktuellerSpieler.Spieler
        Dim Truppen As Integer
        For Each E In Objektverwalter.Spielfeld.Einheiten
            If Not E Is Nothing Then
                If E.Spieler = S Then
                    If E.EinheitenID = EinheitenID Then
                        Truppen += 1
                    End If
                End If
            End If
        Next
        Return Truppen
    End Function
    ''' <summary>
    ''' Ist diese Einheit ein Nahkaempfer!
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function IsNahkampfEinheit() As Boolean
        If Not Waffe1.ToLower = "keine" Then
            Return True
        ElseIf MinimaleReichweite = 1 Then
            Return True
        Else
            Return False
        End If
    End Function
    ''' <summary>
    ''' Gibt die Spieler Farbe zurueck!
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function GetSpielerFarbe() As Color
        Return GetSpieler.Farbe
    End Function
    ''' <summary>
    ''' Wie viele Einheiten haben wir geladen?
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function GetGeladeneEinheitenZahl() As Integer
        Dim T As Integer = 0
        For Each E In Ladung
            If E IsNot Nothing Then
                T += 1
            End If
        Next
        Return T
    End Function
    ''' <summary>
    ''' Schaut nur ob diese Einheit wenn sie sich bewegt Angreifen koennte. Aber nicht ob ein Opfer in der naehe ist
    ''' </summary>
    ''' <param name="X"></param>
    ''' <param name="Y"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function CanAttackFromField(ByVal X As Integer, ByVal Y As Integer, ByVal OpferX As Integer, ByVal OpferY As Integer) As Boolean
        If X = Me.X And Y = Me.Y Then
            Return True
        ElseIf Waffe1.ToLower <> "keine" Or MinimaleReichweite = 1 Then

            If Distance(New Point(X, Y), New Point(OpferX, OpferY)) = 1 Then
                Return True
            End If
        Else
            Dim D As Integer = Distance(New Point(X, Y), New Point(OpferX, OpferY))
            If D >= MinimaleReichweite And D <= MaximaleReichweite Then
                If Munition > 0 Then
                    Return CanIndirectMoveAndFire()
                End If
            End If
        End If
        Return False
    End Function
    Public Function IsDirectUnit() As Boolean
        If Reichweitemin = 1 Then
            Return True
        ElseIf Waffe1 <> "Keine" Then
            Return True
        Else
            Return False
        End If
    End Function
    Public Function IsIndirectUnit() As Boolean
        If Reichweitemax > 1 Then
            If Waffe2 <> "Keine" Then
                Return True
            End If
        End If
        Return False
    End Function
    ''' <summary>
    ''' Berechnet die Reichweite unter einem bestimmten Wetter!
    ''' </summary>
    ''' <param name="Wetter"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function GetMaximalReichweite(ByVal Wetter As ObjektSpielfeld.Wetterarten) As Integer
        Dim RMax As Integer = MaximaleReichweite
        Dim Stelle As Integer = Array.IndexOf(Objektverwalter.Spielfeld.AktuellerSpieler.KOS(0).WetterartfuerSenker, Objektverwalter.Spielfeld.Regeln.Wetter)
        If Stelle >= 0 Then
            Select Case Objektverwalter.Spielfeld.AktuellerSpieler.KOS(0).WetterartfuerSenker(Stelle)
                Case ObjektSpielfeld.Wetterarten.Schnee
                    If Bewegungsart.ToLower <> "wuestenketten" Then
                        RMax -= Objektverwalter.Spielfeld.AktuellerSpieler.KOS(0).WetterReichweitenbonus(Stelle)
                    End If
                Case ObjektSpielfeld.Wetterarten.Sandsturm
                    If Bewegungsart.ToLower <> "schneeketten" Then
                        RMax -= Objektverwalter.Spielfeld.AktuellerSpieler.KOS(0).WetterReichweitenbonus(Stelle)
                    End If
                Case Else
                    RMax -= Objektverwalter.Spielfeld.AktuellerSpieler.KOS(0).WetterReichweitenbonus(Stelle)
            End Select
        End If
        Stelle = Array.IndexOf(Objektverwalter.Spielfeld.AktuellerSpieler.KOS(0).WetterartfuerSenker, Wetter)
        If Stelle >= 0 Then
            Select Case Objektverwalter.Spielfeld.AktuellerSpieler.KOS(0).WetterartfuerSenker(Stelle)
                Case ObjektSpielfeld.Wetterarten.Schnee
                    If Bewegungsart.ToLower <> "wuestenketten" Then

                        RMax += Objektverwalter.Spielfeld.AktuellerSpieler.KOS(0).WetterReichweitenbonus(Stelle)
                    End If
                Case ObjektSpielfeld.Wetterarten.Sandsturm
                    If Bewegungsart.ToLower <> "schneeketten" Then
                        RMax += Objektverwalter.Spielfeld.AktuellerSpieler.KOS(0).WetterReichweitenbonus(Stelle)
                    End If
                Case Else
                    RMax += Objektverwalter.Spielfeld.AktuellerSpieler.KOS(0).WetterReichweitenbonus(Stelle)
            End Select
        End If
        Return RMax
    End Function
    ''' <summary>
    ''' Can this Indirect Unit Move and Fire afterwards?
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function CanIndirectMoveAndFire() As Boolean
        If MaximaleReichweite > 1 Then
            Select Case Faehigkeit.ToLower
                Case "moveandfire", "truppenbau+moveandfire"
                    Return True
                Case Else
                    If GetSpieler.KOS(0).MoveandFire Then
                        Return True
                    End If
            End Select
        End If
        Return False
    End Function
    ''' <summary>
    ''' How expansive this Unit is!
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function GetKosten() As Integer
        Return Koste * GetSpieler.Teurungsrate(EinheitenID, X, Y)
    End Function
    ''' <summary>
    ''' Diese Einheit muss wo gemalt werden.
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function GetFigurPos() As ObjektLandschaftsTextur.Positionsarten
        If IsFlyingUnit() Then
            Return ObjektLandschaftsTextur.Positionsarten.Luft
        ElseIf IsSeaUnit() Then
            Return ObjektLandschaftsTextur.Positionsarten.Wasser
        Else
            Return ObjektLandschaftsTextur.Positionsarten.Boden
        End If
    End Function
#Region "Commander Wars Engine 2"
    ''' <summary>
    ''' Im neusten CoW-Modus erhalten Rang-Einheiten eine Zone die gleiche Einheiten staerkt!
    ''' </summary>
    ''' <remarks></remarks>
    Public Sub EinheitenEffekt()
        Dim S As Integer = GetMap()
        Dim R As Integer = GetUpgradeZone()

        Dim L As ObjektLandschaft = Wegsuchsystem.getFeldRundrum(X, Y, S, 0, R, Nothing, Objektverwalter.Spielfeld)
        Do Until L Is Nothing
            EinheitenEffekt(L.KooX, L.KooY, S)
            L = Wegsuchsystem.getFeldRundrum(X, Y, S, 0, R, L, Objektverwalter.Spielfeld)
        Loop
    End Sub
    Private Sub EinheitenEffekt(ByVal X As Integer, ByVal Y As Integer, ByVal Schlacht As Integer)
        Dim E As ObjektEinheit = Objektverwalter.Spielfeld.Einheiten(X, Y, Schlacht)
        If E IsNot Nothing Then
            If E.Spieler = Spieler Then
                If E.EinheitenID = Me.EinheitenID Then
                    If E.TruppenStufe < TruppenStufe Then
                        UpgradeUnit(E)
                    ElseIf E.Equals(Me) Then
                        UpgradeUnit(E)
                    End If
                End If
            End If
        End If
    End Sub
    Protected Overridable Sub UpgradeUnit(ByVal E As ObjektEinheit)
        Select Case EinheitenStufe
            Case ObjektEinheit.Stufe.Leutnant
                E.ATKDEFBoost.X += 5
            Case Stufe.Offizier
                E.ATKDEFBoost.X += 10
            Case Stufe.General
                E.ATKDEFBoost.X += 10
                E.ATKDEFBoost.Y += 10
            Case Stufe.Veteran
                E.ATKDEFBoost.X += 15
                E.ATKDEFBoost.Y += 15
            Case Stufe.KO
                E.ATKDEFBoost.X += 15
                E.ATKDEFBoost.Y += 15
            Case Else
        End Select
    End Sub
    Public Function GetUpgradeZone() As Integer
        Select Case EinheitenStufe
            Case Stufe.Soldat
                Return -1
            Case Stufe.Leutnant
                Return 0
            Case Stufe.Offizier
                Return 1
            Case Stufe.General
                Return 2
            Case Else
                Return 2
        End Select
    End Function
#End Region
#End Region
#Region "Malen"
    Shared MaxTimer As Double = 0
    Public Overridable Sub Malen(ByVal X As Integer, ByVal Y As Integer, ByVal Alpha As Integer)
        If Sichtbarkeit = True And Tod = False And Leben > 0 And BildID >= 0 Then
            If DataSettings.draw3D Then
                If Grafikengine.IsSphaereInFrustumPlane(New Vector3(X, 1, -Y), 2) Then
                    If AnimPos >= AnimPeriode Then
                        If AnimAuszeit = 0 Then
                            'Einen neustart. Juhuu!
                            SetAnimation(AnimSetNaechsterName.ToString)

                            'Der Wait-Zyklus wird staendig wiederhohlt. Allerdings mit abwechselnder zwischenwartezeit
                            If Me.AnimSetName = AnimationSets3D.Wait.ToString Then
                                SetFolgeAnimation(AnimationSets3D.Wait.ToString, Zufallszahl(10, 30))
                            End If
                        End If
                        'wir sind am Ende angelangt.
                        If Me.AnimAuszeit >= 0 Then
                            Me.AnimAuszeit -= 1
                        End If
                    End If
                    ' ObjektLadeklasse.Einheit3D.Malen(EinheitenID, X, Y, GetMap, Spieler, Rotation, HatsichBewegt, AnimSetName, AnimPos, AnimPeriode)

                    Dim Hoehe As Single = GetHoehenVerschiebung()
                    ObjektLadeklasse.Einheit3D.Malen(Me, X, Y, GetMap, Spieler, Rotation, HatsichBewegt, AnimController, AnimPeriode, Hoehe)

                    SymboleMalen(ObjektLadeklasse.Einheit3D.getPos(X, Y + Hoehe, Me, GetMap)) 'naja eigentlich ist die Farbe egal, aber damit es alle gluecklich macht...
                End If
            ElseIf DataSettings._2D_3D_Malen Then
                Dim intColor As Color
                If HatsichBewegt = True Then
                    intColor = Color.FromArgb(Alpha, 150, 150, 150)
                Else
                    If Hauptmenue.Formmodus = Hauptmenue.Formmodi.Spiel Then
                        Select Case Objektverwalter.Spielfeld.Spieler(Spieler).KOS(0).Gabemodus
                            Case ObjektKO.Gabemodi.Gabe
                                intColor = Color.FromArgb(Alpha, 255 - Frame * 5, 255 - Frame * 10, 255 - Frame * 15)
                            Case ObjektKO.Gabemodi.Spezialgabe
                                intColor = Color.FromArgb(Alpha, 255 - Frame * 15, 255 - Frame * 10, 255 - Frame * 5)
                            Case ObjektKO.Gabemodi.Doppelgabe
                                intColor = Color.FromArgb(Alpha, 255 - Frame * 10, 255 - Frame * 15, 255 - Frame * 5)
                            Case Else
                                intColor = Color.FromArgb(Alpha, 255, 255, 255)
                        End Select
                    Else
                        intColor = Color.FromArgb(Alpha, 255, 255, 255)
                    End If
                End If
                Dim Cube(3) As CustomVertex.PositionTextured
                Dim S As ObjektSpieler = GetSpieler()
                Dim R As Integer
                Math.DivRem(S.Spieler, 2, R)
                Dim Flip As Boolean = False
                If R = 0 Then
                    Flip = True
                End If

                If Objektverwalter.Spielfeld.GetCommanderWarsModus = CommanderWarsGameModi.FireEmblem Then

                Else
                    If Flip Then
                        Cube(0) = New CustomVertex.PositionTextured(0, 0, 0, 0.25 * Frame + 0.25, 1)
                        Cube(1) = New CustomVertex.PositionTextured(0, 0, 1, 0.25 * Frame + 0.25, 0)
                        Cube(2) = New CustomVertex.PositionTextured(1, 0, 0, 0.25 * Frame, 1)
                        Cube(3) = New CustomVertex.PositionTextured(1, 0, 1, 0.25 * Frame, 0)
                    Else
                        Cube(0) = New CustomVertex.PositionTextured(0, 0, 0, 0.25 * Frame, 1)
                        Cube(1) = New CustomVertex.PositionTextured(0, 0, 1, 0.25 * Frame, 0)
                        Cube(2) = New CustomVertex.PositionTextured(1, 0, 0, 0.25 * Frame + 0.25, 1)
                        Cube(3) = New CustomVertex.PositionTextured(1, 0, 1, 0.25 * Frame + 0.25, 0)
                    End If
                End If

                If Not S Is Nothing Then
                    If Not Hauptmenue.Formmodus = Hauptmenue.Formmodi.Editor Then
                        If S.KOS(0).SpriteVertauschung = True And S.Team <> Objektverwalter.Spielfeld.Spieler(Objektverwalter.Spielfeld.Regeln.LetzterMensch).Team Then
                            Grafikengine.malen2Din3D(ObjektSpielfeld.CalcDraw2D3DVec(X, ObjektSpielfeld.SpielfeldLayer.Einheiten, Y), Cube, Objektverwalter.AlleEinheiten(INFID).GetEinheitentextur(S.Armee), intColor)
                            If intColor <> Hauptmenue.NeutralFarbe Then
                                intColor = ObjektmarkiertesFeld.getMischfarbe(intColor, S.Farbe, 0.5#, False)
                            Else
                                intColor = S.Farbe
                            End If
                            Grafikengine.malen2Din3D(ObjektSpielfeld.CalcDraw2D3DVec(X, ObjektSpielfeld.SpielfeldLayer.Einheiten, Y), Cube, Objektverwalter.AlleEinheiten(INFID).GetEinheitentexturMaske(S.Armee), intColor)
                        Else
                            Grafikengine.malen2Din3D(ObjektSpielfeld.CalcDraw2D3DVec(X, ObjektSpielfeld.SpielfeldLayer.Einheiten, Y), Cube, Objektverwalter.AlleEinheiten(BildID).GetEinheitentextur(S.Armee), intColor)
                            If intColor <> Hauptmenue.NeutralFarbe Then
                                intColor = ObjektmarkiertesFeld.getMischfarbe(intColor, S.Farbe, 0.5#, False)
                            Else
                                intColor = S.Farbe
                            End If
                            Grafikengine.malen2Din3D(ObjektSpielfeld.CalcDraw2D3DVec(X, ObjektSpielfeld.SpielfeldLayer.Einheiten, Y), Cube, Objektverwalter.AlleEinheiten(BildID).GetEinheitentexturMaske(S.Armee), intColor)
                        End If
                    Else
                        Grafikengine.malen2Din3D(ObjektSpielfeld.CalcDraw2D3DVec(X, ObjektSpielfeld.SpielfeldLayer.Einheiten, Y), Cube, Objektverwalter.AlleEinheiten(BildID).GetEinheitentextur(S.Armee), intColor)
                        If intColor <> Hauptmenue.NeutralFarbe Then
                            intColor = ObjektmarkiertesFeld.getMischfarbe(intColor, S.Farbe, 0.5#, False)
                        Else
                            intColor = S.Farbe
                        End If
                        Grafikengine.malen2Din3D(ObjektSpielfeld.CalcDraw2D3DVec(X, ObjektSpielfeld.SpielfeldLayer.Einheiten, Y), Cube, Objektverwalter.AlleEinheiten(BildID).GetEinheitentexturMaske(S.Armee), intColor)
                    End If
                End If
                'Symbole und Leben Malen.
                If Objektverwalter.Spielfeld.GetCommanderWarsModus <> CommanderWarsGameModi.FireEmblem Then
                    intColor = Hauptmenue.NeutralFarbe
                    'Wir malen das Leben verloren Symbol
                    If Hauptmenue.Formmodus = Hauptmenue.Formmodi.Editor Then
                        If Leben <= 90 Then
                            Dim I As Integer = Math.DivRem(CInt(Leben), 10, 0)
                            If Leben - I * 10 > 0 Then
                                I += 1
                            End If
                            I = FindElement(Objektverwalter.Symbolfunktion, I, True)
                            Cube(0) = New CustomVertex.PositionTextured(0, 0, 0, 0, 1)
                            Cube(1) = New CustomVertex.PositionTextured(0, 0, 0.5, 0, 0)
                            Cube(2) = New CustomVertex.PositionTextured(0.5, 0, 0, 1, 1)
                            Cube(3) = New CustomVertex.PositionTextured(0.5, 0, 0.5, 1, 0)
                            Grafikengine.malen2Din3D(ObjektSpielfeld.CalcDraw2D3DVec(X + 0.5, ObjektSpielfeld.SpielfeldLayer.Einheitensymbole, Y), Cube, Objektverwalter.Symbole(I), intColor)
                        End If

                        SymboleMalen(intColor)
                    Else
                        If Spieler > 0 Then
                            If Objektverwalter.Spielfeld.Spieler(Spieler).KOS(0).Verstecker = False Or Objektverwalter.Spielfeld.Spieler(Spieler).Team = Objektverwalter.Spielfeld.Spieler(Objektverwalter.Spielfeld.Regeln.LetzterMensch).Team Then
                                If Leben <= 90 Then
                                    Dim I As Integer = Math.DivRem(CInt(Leben), 10, 0)
                                    If Leben - I * 10 > 0 Then
                                        I += 1
                                    End If
                                    I = FindElement(Objektverwalter.Symbolfunktion, I, True)
                                    Cube(0) = New CustomVertex.PositionTextured(0, 0, 0, 0, 1)
                                    Cube(1) = New CustomVertex.PositionTextured(0, 0, 0.5, 0, 0)
                                    Cube(2) = New CustomVertex.PositionTextured(0.5, 0, 0, 1, 1)
                                    Cube(3) = New CustomVertex.PositionTextured(0.5, 0, 0.5, 1, 0)
                                    Grafikengine.malen2Din3D(ObjektSpielfeld.CalcDraw2D3DVec(X + 0.5, ObjektSpielfeld.SpielfeldLayer.Einheitensymbole, Y), Cube, Objektverwalter.Symbole(I), intColor)
                                End If
                            ElseIf GetSpieler.KOS(0).KOBoostApply(X, Y) Then
                                Dim I As Integer = FindElement(Objektverwalter.Symbolfunktion, "Fragezeichen", True)
                                Cube(0) = New CustomVertex.PositionTextured(0, 0, 0, 0, 1)
                                Cube(1) = New CustomVertex.PositionTextured(0, 0, 0.5, 0, 0)
                                Cube(2) = New CustomVertex.PositionTextured(0.5, 0, 0, 1, 1)
                                Cube(3) = New CustomVertex.PositionTextured(0.5, 0, 0.5, 1, 0)
                                Grafikengine.malen2Din3D(ObjektSpielfeld.CalcDraw2D3DVec(X + 0.5, ObjektSpielfeld.SpielfeldLayer.Einheitensymbole, Y), Cube, Objektverwalter.Symbole(I), intColor)
                            Else
                                If Leben <= 90 Then
                                    Dim I As Integer = Math.DivRem(CInt(Leben), 10, 0)
                                    If Leben - I * 10 > 0 Then
                                        I += 1
                                    End If
                                    I = FindElement(Objektverwalter.Symbolfunktion, I, True)
                                    Cube(0) = New CustomVertex.PositionTextured(0, 0, 0, 0, 1)
                                    Cube(1) = New CustomVertex.PositionTextured(0, 0, 0.5, 0, 0)
                                    Cube(2) = New CustomVertex.PositionTextured(0.5, 0, 0, 1, 1)
                                    Cube(3) = New CustomVertex.PositionTextured(0.5, 0, 0.5, 1, 0)
                                    Grafikengine.malen2Din3D(ObjektSpielfeld.CalcDraw2D3DVec(X + 0.5, ObjektSpielfeld.SpielfeldLayer.Einheitensymbole, Y), Cube, Objektverwalter.Symbole(I), intColor)
                                End If
                            End If
                        End If
                        If Spieler >= 0 Then
                            SymboleMalen(intColor)
                        End If
                    End If
                End If

            Else

                'Welchen Teil des Bildes wir malen wollen
                Dim sngRotation As Double = 0
                Dim intColor As Color
                If HatsichBewegt = True Then
                    intColor = Color.FromArgb(Alpha, 150, 150, 150)
                Else
                    If Hauptmenue.Formmodus = Hauptmenue.Formmodi.Spiel Then
                        Select Case Objektverwalter.Spielfeld.Spieler(Spieler).KOS(0).Gabemodus
                            Case ObjektKO.Gabemodi.Gabe
                                intColor = Color.FromArgb(Alpha, 255 - Frame * 5, 255 - Frame * 10, 255 - Frame * 15)
                            Case ObjektKO.Gabemodi.Spezialgabe
                                intColor = Color.FromArgb(Alpha, 255 - Frame * 15, 255 - Frame * 10, 255 - Frame * 5)
                            Case ObjektKO.Gabemodi.Doppelgabe
                                intColor = Color.FromArgb(Alpha, 255 - Frame * 10, 255 - Frame * 15, 255 - Frame * 5)
                            Case Else
                                intColor = Color.FromArgb(Alpha, 255, 255, 255)
                        End Select
                    Else
                        intColor = Color.FromArgb(Alpha, 255, 255, 255)
                    End If
                End If

                'pruefen ob wir aus den Screenbereich laufen

                'Festlegen welchen Bereich vom Bitmap wir kopieren

                'Welcher Teil der Textur soll gemalt werden Nichts bedeutet gesamtes Bild
                If Objektverwalter.Spielfeld.GetCommanderWarsModus = CommanderWarsGameModi.FireEmblem Then
                    Dim FireEmblemUnit As Fire_Emblem_MOD.FEUnit = Me
                    With Grafikengine.recBild
                        .X = FireEmblemUnit.UnitSize.Width * Frame : .Width = FireEmblemUnit.UnitSize.Width
                        .Y = 0 : .Height = FireEmblemUnit.UnitSize.Height
                    End With
                    'Falls der Zoomfaktor groesser 1 ist muessen einige Raender abgeschnitten werden
                    'Achtung Rotationszentrum ist auch Ausgangspunkt der bemalung
                    With Grafikengine.ptfRotCenter
                        .X = FireEmblemUnit.UnitSize.Width / 2
                        .Y = FireEmblemUnit.UnitSize.Height - Hauptmenue.Feldbreite / 2
                    End With
                    Grafikengine.szfScale = FireEmblemUnit.UnitSize
                Else
                    With Grafikengine.recBild
                        .X = Hauptmenue.Feldbreite * Frame : .Width = Hauptmenue.Feldbreite
                        .Y = 0 : .Height = Hauptmenue.Feldbreite
                    End With
                    'Falls der Zoomfaktor groesser 1 ist muessen einige Raender abgeschnitten werden
                    'Achtung Rotationszentrum ist auch Ausgangspunkt der bemalung
                    With Grafikengine.ptfRotCenter
                        .X = Hauptmenue.Feldbreite / 2
                        .Y = Hauptmenue.Feldbreite / 2
                    End With
                    With Grafikengine.szfScale
                        .Height = Hauptmenue.Feldbreite
                        .Width = Hauptmenue.Feldbreite
                    End With
                End If
                Grafikengine.ptfPosition = New Drawing.Point(Hauptmenue.Feldbreite * X + Objektverwalter.Spielfeld.BildschirmKooX, Hauptmenue.Feldbreite * Y + Objektverwalter.Spielfeld.BildschirmKooY)

                'Ausschnitte in den Backbuffer zeichnen
                'Wo wird das Bild gezeichnet
                '16 ist die Breite eines Feldes 8 die Haelfte das heisst wir ermitteln den Mittelpunkt des Feldes und ziehen die Haelfte der Groesse der Einheit ab
                '... und wie breit ist es




                'jetzt wird es in den Backbuffer gezeichnet
                Dim S As ObjektSpieler = GetSpieler()
                Dim R As Integer
                Math.DivRem(S.Spieler, 2, R)
                If R = 0 Then
                    Grafikengine.szfScale.Width *= -1
                End If
                If Not S Is Nothing Then
                    If Not Hauptmenue.Formmodus = Hauptmenue.Formmodi.Editor Then
                        If S.KOS(0).SpriteVertauschung = True And S.Team <> Objektverwalter.Spielfeld.Spieler(Objektverwalter.Spielfeld.Regeln.LetzterMensch).Team Then
                            Grafikengine.Sprite.Draw2D(Objektverwalter.AlleEinheiten(INFID).GetEinheitentextur(S.Armee), Grafikengine.recBild, Grafikengine.szfScale, Grafikengine.ptfRotCenter, sngRotation, Grafikengine.ptfPosition, intColor)
                            If intColor <> Hauptmenue.NeutralFarbe Then
                                intColor = ObjektmarkiertesFeld.getMischfarbe(intColor, S.Farbe, 0.5#, False)
                            Else
                                intColor = S.Farbe
                            End If
                            Grafikengine.Sprite.Draw2D(Objektverwalter.AlleEinheiten(INFID).GetEinheitentexturMaske(S.Armee), Grafikengine.recBild, Grafikengine.szfScale, Grafikengine.ptfRotCenter, sngRotation, Grafikengine.ptfPosition, intColor)

                        Else
                            Grafikengine.Sprite.Draw2D(Objektverwalter.AlleEinheiten(BildID).GetEinheitentextur(S.Armee), Grafikengine.recBild, Grafikengine.szfScale, Grafikengine.ptfRotCenter, sngRotation, Grafikengine.ptfPosition, intColor)
                            If intColor <> Hauptmenue.NeutralFarbe Then
                                intColor = ObjektmarkiertesFeld.getMischfarbe(intColor, S.Farbe, 0.5#, False)
                            Else
                                intColor = S.Farbe
                            End If
                            Grafikengine.Sprite.Draw2D(Objektverwalter.AlleEinheiten(BildID).GetEinheitentexturMaske(S.Armee), Grafikengine.recBild, Grafikengine.szfScale, Grafikengine.ptfRotCenter, sngRotation, Grafikengine.ptfPosition, intColor)

                        End If
                    Else
                        Grafikengine.Sprite.Draw2D(Objektverwalter.AlleEinheiten(BildID).GetEinheitentextur(S.Armee), Grafikengine.recBild, Grafikengine.szfScale, Grafikengine.ptfRotCenter, sngRotation, Grafikengine.ptfPosition, intColor)
                        If intColor <> Hauptmenue.NeutralFarbe Then
                            intColor = ObjektmarkiertesFeld.getMischfarbe(intColor, S.Farbe, 0.5#, False)
                        Else
                            intColor = S.Farbe
                        End If
                        Grafikengine.Sprite.Draw2D(Objektverwalter.AlleEinheiten(BildID).GetEinheitentexturMaske(S.Armee), Grafikengine.recBild, Grafikengine.szfScale, Grafikengine.ptfRotCenter, sngRotation, Grafikengine.ptfPosition, intColor)

                    End If
                End If

                If Objektverwalter.Spielfeld.GetCommanderWarsModus <> CommanderWarsGameModi.FireEmblem Then
                    intColor = Hauptmenue.NeutralFarbe
                    'Wir malen das Leben verloren Symbol
                    If Hauptmenue.Formmodus = Hauptmenue.Formmodi.Editor Then
                        If Leben <= 90 Then
                            Dim I As Integer = Math.DivRem(CInt(Leben), 10, 0)
                            If Leben - I * 10 > 0 Then
                                I += 1
                            End If
                            I = FindElement(Objektverwalter.Symbolfunktion, I, True)
                            With Grafikengine.ptfRotCenter
                                .X = 0
                                .Y = 0
                            End With

                            With Grafikengine.recBild
                                .X = 0 : .Width = Hauptmenue.Feldbreite / 2
                                .Y = 0 : .Height = Hauptmenue.Feldbreite / 2
                            End With
                            'Falls der Zoomfaktor groesser 1 ist muessen einige Raender abgeschnitten werden
                            With Grafikengine.szfScale
                                .Height = Hauptmenue.Feldbreite / 2
                                .Width = Hauptmenue.Feldbreite / 2
                            End With
                            Grafikengine.Sprite.Draw2D(Objektverwalter.Symbole(I), Grafikengine.recBild, Grafikengine.szfScale, Grafikengine.ptfRotCenter, sngRotation, Grafikengine.ptfPosition, intColor)
                        End If
                        SymboleMalen(intColor)
                    Else
                        If Spieler > 0 Then
                            If Objektverwalter.Spielfeld.Spieler(Spieler).KOS(0).Verstecker = False Or Objektverwalter.Spielfeld.Spieler(Spieler).Team = Objektverwalter.Spielfeld.Spieler(Objektverwalter.Spielfeld.Regeln.LetzterMensch).Team Then
                                If Leben <= 90 Then
                                    Dim I As Integer = Math.DivRem(CInt(Leben), 10, 0)
                                    If Leben - I * 10 > 0 Then
                                        I += 1
                                    End If
                                    I = FindElement(Objektverwalter.Symbolfunktion, I, True)
                                    With Grafikengine.ptfRotCenter
                                        .X = 0
                                        .Y = 0
                                    End With

                                    With Grafikengine.recBild
                                        .X = 0 : .Width = Hauptmenue.Feldbreite / 2
                                        .Y = 0 : .Height = Hauptmenue.Feldbreite / 2
                                    End With
                                    'Falls der Zoomfaktor groesser 1 ist muessen einige Raender abgeschnitten werden
                                    With Grafikengine.szfScale
                                        .Height = Hauptmenue.Feldbreite / 2
                                        .Width = Hauptmenue.Feldbreite / 2
                                    End With
                                    Grafikengine.Sprite.Draw2D(Objektverwalter.Symbole(I), Grafikengine.recBild, Grafikengine.szfScale, Grafikengine.ptfRotCenter, sngRotation, Grafikengine.ptfPosition, intColor)
                                End If
                            ElseIf GetSpieler.KOS(0).KOBoostApply(X, Y) Then
                                Dim I As Integer = FindElement(Objektverwalter.Symbolfunktion, "Fragezeichen", True)
                                With Grafikengine.ptfRotCenter
                                    .X = 0
                                    .Y = 0
                                End With

                                With Grafikengine.recBild
                                    .X = 0 : .Width = Hauptmenue.Feldbreite / 2
                                    .Y = 0 : .Height = Hauptmenue.Feldbreite / 2
                                End With
                                'Falls der Zoomfaktor groesser 1 ist muessen einige Raender abgeschnitten werden
                                With Grafikengine.szfScale
                                    .Height = Hauptmenue.Feldbreite / 2
                                    .Width = Hauptmenue.Feldbreite / 2
                                End With
                                Grafikengine.Sprite.Draw2D(Objektverwalter.Symbole(I), Grafikengine.recBild, Grafikengine.szfScale, Grafikengine.ptfRotCenter, sngRotation, Grafikengine.ptfPosition, intColor)
                            Else
                                'Wir malen das Leben
                                If Leben <= 90 Then
                                    Dim I As Integer = Math.DivRem(CInt(Leben), 10, 0)
                                    If Leben - I * 10 > 0 Then
                                        I += 1
                                    End If
                                    I = FindElement(Objektverwalter.Symbolfunktion, I, True)
                                    With Grafikengine.ptfRotCenter
                                        .X = 0
                                        .Y = 0
                                    End With

                                    With Grafikengine.recBild
                                        .X = 0 : .Width = Hauptmenue.Feldbreite / 2
                                        .Y = 0 : .Height = Hauptmenue.Feldbreite / 2
                                    End With
                                    'Falls der Zoomfaktor groesser 1 ist muessen einige Raender abgeschnitten werden
                                    With Grafikengine.szfScale
                                        .Height = Hauptmenue.Feldbreite / 2
                                        .Width = Hauptmenue.Feldbreite / 2
                                    End With
                                    Grafikengine.Sprite.Draw2D(Objektverwalter.Symbole(I), Grafikengine.recBild, Grafikengine.szfScale, Grafikengine.ptfRotCenter, sngRotation, Grafikengine.ptfPosition, intColor)
                                End If
                            End If
                        Else
                            Dim I As Integer = FindElement(Objektverwalter.Symbolfunktion, "Fragezeichen", True)
                            With Grafikengine.ptfRotCenter
                                .X = 0
                                .Y = 0
                            End With

                            With Grafikengine.recBild
                                .X = 0 : .Width = Hauptmenue.Feldbreite / 2
                                .Y = 0 : .Height = Hauptmenue.Feldbreite / 2
                            End With
                            'Falls der Zoomfaktor groesser 1 ist muessen einige Raender abgeschnitten werden
                            With Grafikengine.szfScale
                                .Height = Hauptmenue.Feldbreite / 2
                                .Width = Hauptmenue.Feldbreite / 2
                            End With
                            Grafikengine.Sprite.Draw2D(Objektverwalter.Symbole(I), Grafikengine.recBild, Grafikengine.szfScale, Grafikengine.ptfRotCenter, sngRotation, Grafikengine.ptfPosition, intColor)
                        End If
                        If Spieler >= 0 Then
                            SymboleMalen(intColor)
                        End If
                    End If
                End If
            End If
        End If
    End Sub



    ''' <summary>
    ''' 
    ''' </summary>
    ''' <param name="Ortsvektor">3D-Symbole</param>
    ''' <remarks></remarks>
    Public Sub SymboleMalen(ByVal Ortsvektor As Vector3)
        If Tarnung Then
            'Tarnungszeichen
            Symbol3D.Symbolmalen(Ortsvektor, Symbol3D.Zeichenarten.Tarnung)
        End If
        If Besetzen Then
            'Besetzungszeichen
            Symbol3D.Symbolmalen(Ortsvektor, Symbol3D.Zeichenarten.Besetzen)
        End If
        If MunitionMax > 0 Then
            If Not HasMaterial() Then
                If Munition <= MunitionMax / 3 Then
                    'Munitionszeichen
                    Symbol3D.Symbolmalen(Ortsvektor, Symbol3D.Zeichenarten.Munition)
                End If
            End If
        End If
        If SpritMax > 0 Then
            If Treibstoff <= SpritMax / 3 Then
                'Treibstoffzeichen
                Symbol3D.Symbolmalen(Ortsvektor, Symbol3D.Zeichenarten.Treibstoff)
            End If
        End If

        'Ladungszeichen
        If Ladung.Length > 0 Then
            If Objektverwalter.Spielfeld.Regeln.Nebel > 0 Then
                If IsNothing(Ladung(0)) = False Then
                    Symbol3D.Symbolmalen(Ortsvektor, Symbol3D.Zeichenarten.Ladung)
                ElseIf Not Objektverwalter.Spielfeld.Spieler(Spieler).Team = Objektverwalter.Spielfeld.Spieler(Objektverwalter.Spielfeld.Regeln.LetzterMensch).Team Then
                    Symbol3D.Symbolmalen(Ortsvektor, Symbol3D.Zeichenarten.Ladung)
                End If
            ElseIf Hauptmenue.Formmodus = Hauptmenue.Formmodi.Spiel Then
                If Objektverwalter.Spielfeld.Spieler(Spieler).KOS(0).Verstecker = True And GetSpieler.KOS(0).KOBoostApply(X, Y) Then
                    If Not Objektverwalter.Spielfeld.Spieler(Spieler).Team = Objektverwalter.Spielfeld.Spieler(Objektverwalter.Spielfeld.Regeln.LetzterMensch).Team Then
                        Symbol3D.Symbolmalen(Ortsvektor, Symbol3D.Zeichenarten.Ladung)
                    ElseIf IsNothing(Ladung(0)) = False Then
                        Symbol3D.Symbolmalen(Ortsvektor, Symbol3D.Zeichenarten.Ladung)
                    End If
                ElseIf IsNothing(Ladung(0)) = False Then
                    Symbol3D.Symbolmalen(Ortsvektor, Symbol3D.Zeichenarten.Ladung)
                End If
            ElseIf IsNothing(Ladung(0)) = False Then
                Symbol3D.Symbolmalen(Ortsvektor, Symbol3D.Zeichenarten.Ladung)
            End If
        End If
    End Sub
    ''' <summary>
    ''' 
    ''' </summary>
    ''' <param name="intcolor">2D-Symbole</param>
    ''' <remarks></remarks>
    Public Sub SymboleMalen(ByVal intcolor As Color)
        Dim Count As Integer = 0
        If Tarnung = True Then Count += 1
        If Besetzen = True Then Count += 1
        If MunitionMax > 0 Then
            If Not HasMaterial() Then
                If Munition <= MunitionMax / 3 Then Count += 1
            End If
        End If
        If SpritMax > 0 Then
            If Treibstoff <= SpritMax / 3 Then Count += 1
        End If
        If Ladung.Length > 0 Then
            If Objektverwalter.Spielfeld.Regeln.Nebel > 0 Then
                If IsNothing(Ladung(0)) = False Then
                    Count += 1
                ElseIf Not Objektverwalter.Spielfeld.Spieler(Spieler).Team = Objektverwalter.Spielfeld.Spieler(Objektverwalter.Spielfeld.Regeln.LetzterMensch).Team Then
                    Count += 1
                End If
            ElseIf Hauptmenue.Formmodus = Hauptmenue.Formmodi.Spiel Then
                If Objektverwalter.Spielfeld.Spieler(Spieler).KOS(0).Verstecker = True And GetSpieler.KOS(0).KOBoostApply(X, Y) Then
                    If Not Objektverwalter.Spielfeld.Spieler(Spieler).Team = Objektverwalter.Spielfeld.Spieler(Objektverwalter.Spielfeld.Regeln.LetzterMensch).Team Then
                        Count += 1
                    ElseIf IsNothing(Ladung(0)) = False Then
                        Count += 1
                    End If
                ElseIf IsNothing(Ladung(0)) = False Then
                    Count += 1
                End If
            ElseIf IsNothing(Ladung(0)) = False Then
                Count += 1
            End If
        End If
        If Count > 0 Then
            Dim Cube(3) As CustomVertex.PositionTextured
            If DataSettings._2D_3D_Malen Then
                Cube(0) = New CustomVertex.PositionTextured(0, 0, 0, 0, 1)
                Cube(1) = New CustomVertex.PositionTextured(0, 0, 0.5, 0, 0)
                Cube(2) = New CustomVertex.PositionTextured(0.5, 0, 0, 1, 1)
                Cube(3) = New CustomVertex.PositionTextured(0.5, 0, 0.5, 1, 0)
            Else
                'Wir aendern das Rotationszentrum zum malen
                Grafikengine.ptfRotCenter = Nothing
                With Grafikengine.recBild
                    .X = 0 : .Width = Hauptmenue.Feldbreite / 2
                    .Y = 0 : .Height = Hauptmenue.Feldbreite / 2
                End With
                'Falls der Zoomfaktor groesser 1 ist muessen einige Raender abgeschnitten werden
                With Grafikengine.szfScale
                    .Height = Hauptmenue.Feldbreite / 2
                    .Width = Hauptmenue.Feldbreite / 2
                End With
                Grafikengine.ptfPosition.X -= Hauptmenue.Feldbreite / 2
            End If

            Dim I As Integer = -1
            If Count > 1 Then
                Select Case Frame
                    Case 0
                        If Besetzen = True Then
                            I = FindElement(Objektverwalter.Symbolfunktion, "Fahnenzeichen", True)
                            If DataSettings._2D_3D_Malen Then
                                Grafikengine.malen2Din3D(ObjektSpielfeld.CalcDraw2D3DVec(X, ObjektSpielfeld.SpielfeldLayer.Einheitensymbole, Y), Cube, Objektverwalter.Symbole(I), intcolor)
                            Else
                                Grafikengine.Sprite.Draw2D(Objektverwalter.Symbole(I), Grafikengine.recBild, Grafikengine.szfScale, Grafikengine.ptfRotCenter, 0, Grafikengine.ptfPosition, intcolor)
                            End If
                        ElseIf Ladung.Length > 0 Then
                            If Objektverwalter.Spielfeld.Regeln.Nebel > 0 Then
                                If IsNothing(Ladung(0)) = False Then
                                    I = FindElement(Objektverwalter.Symbolfunktion, "Transportzeichen", True)
                                    If DataSettings._2D_3D_Malen Then
                                        Grafikengine.malen2Din3D(ObjektSpielfeld.CalcDraw2D3DVec(X, ObjektSpielfeld.SpielfeldLayer.Einheitensymbole, Y), Cube, Objektverwalter.Symbole(I), intcolor)
                                    Else
                                        Grafikengine.Sprite.Draw2D(Objektverwalter.Symbole(I), Grafikengine.recBild, Grafikengine.szfScale, Grafikengine.ptfRotCenter, 0, Grafikengine.ptfPosition, intcolor)
                                    End If
                                ElseIf Not Objektverwalter.Spielfeld.Spieler(Spieler).Team = Objektverwalter.Spielfeld.Spieler(Objektverwalter.Spielfeld.Regeln.LetzterMensch).Team Then
                                    I = FindElement(Objektverwalter.Symbolfunktion, "Transportzeichenkeineahnung", True)
                                    If DataSettings._2D_3D_Malen Then
                                        Grafikengine.malen2Din3D(ObjektSpielfeld.CalcDraw2D3DVec(X, ObjektSpielfeld.SpielfeldLayer.Einheitensymbole, Y), Cube, Objektverwalter.Symbole(I), intcolor)
                                    Else
                                        Grafikengine.Sprite.Draw2D(Objektverwalter.Symbole(I), Grafikengine.recBild, Grafikengine.szfScale, Grafikengine.ptfRotCenter, 0, Grafikengine.ptfPosition, intcolor)
                                    End If
                                End If
                            ElseIf Hauptmenue.Formmodus = Hauptmenue.Formmodi.Spiel Then
                                If Objektverwalter.Spielfeld.Spieler(Spieler).KOS(0).Verstecker = True And GetSpieler.KOS(0).KOBoostApply(X, Y) Then
                                    If Not Objektverwalter.Spielfeld.Spieler(Spieler).Team = Objektverwalter.Spielfeld.Spieler(Objektverwalter.Spielfeld.Regeln.LetzterMensch).Team Then
                                        I = FindElement(Objektverwalter.Symbolfunktion, "Transportzeichenkeineahnung", True)
                                        If DataSettings._2D_3D_Malen Then
                                            Grafikengine.malen2Din3D(ObjektSpielfeld.CalcDraw2D3DVec(X, ObjektSpielfeld.SpielfeldLayer.Einheitensymbole, Y), Cube, Objektverwalter.Symbole(I), intcolor)
                                        Else
                                            Grafikengine.Sprite.Draw2D(Objektverwalter.Symbole(I), Grafikengine.recBild, Grafikengine.szfScale, Grafikengine.ptfRotCenter, 0, Grafikengine.ptfPosition, intcolor)
                                        End If
                                    ElseIf IsNothing(Ladung(0)) = False Then
                                        I = FindElement(Objektverwalter.Symbolfunktion, "Transportzeichen", True)
                                        If DataSettings._2D_3D_Malen Then
                                            Grafikengine.malen2Din3D(ObjektSpielfeld.CalcDraw2D3DVec(X, ObjektSpielfeld.SpielfeldLayer.Einheitensymbole, Y), Cube, Objektverwalter.Symbole(I), intcolor)
                                        Else
                                            Grafikengine.Sprite.Draw2D(Objektverwalter.Symbole(I), Grafikengine.recBild, Grafikengine.szfScale, Grafikengine.ptfRotCenter, 0, Grafikengine.ptfPosition, intcolor)
                                        End If
                                    End If
                                ElseIf IsNothing(Ladung(0)) = False Then
                                    I = FindElement(Objektverwalter.Symbolfunktion, "Transportzeichen", True)
                                    If DataSettings._2D_3D_Malen Then
                                        Grafikengine.malen2Din3D(ObjektSpielfeld.CalcDraw2D3DVec(X, ObjektSpielfeld.SpielfeldLayer.Einheitensymbole, Y), Cube, Objektverwalter.Symbole(I), intcolor)
                                    Else
                                        Grafikengine.Sprite.Draw2D(Objektverwalter.Symbole(I), Grafikengine.recBild, Grafikengine.szfScale, Grafikengine.ptfRotCenter, 0, Grafikengine.ptfPosition, intcolor)
                                    End If
                                End If
                            ElseIf IsNothing(Ladung(0)) = False Then
                                I = FindElement(Objektverwalter.Symbolfunktion, "Transportzeichen", True)
                                If DataSettings._2D_3D_Malen Then
                                    Grafikengine.malen2Din3D(ObjektSpielfeld.CalcDraw2D3DVec(X, ObjektSpielfeld.SpielfeldLayer.Einheitensymbole, Y), Cube, Objektverwalter.Symbole(I), intcolor)
                                Else
                                    Grafikengine.Sprite.Draw2D(Objektverwalter.Symbole(I), Grafikengine.recBild, Grafikengine.szfScale, Grafikengine.ptfRotCenter, 0, Grafikengine.ptfPosition, intcolor)
                                End If
                            End If
                        End If
                    Case 1
                        If Tarnung = True Or Feldtarnung = True Then
                            I = FindElement(Objektverwalter.Symbolfunktion, "Tauchzeichen", True)
                            If DataSettings._2D_3D_Malen Then
                                Grafikengine.malen2Din3D(ObjektSpielfeld.CalcDraw2D3DVec(X, ObjektSpielfeld.SpielfeldLayer.Einheitensymbole, Y), Cube, Objektverwalter.Symbole(I), intcolor)
                            Else
                                Grafikengine.Sprite.Draw2D(Objektverwalter.Symbole(I), Grafikengine.recBild, Grafikengine.szfScale, Grafikengine.ptfRotCenter, 0, Grafikengine.ptfPosition, intcolor)
                            End If
                        End If
                    Case 2
                        If Munition <= MunitionMax / 3 Then
                            I = FindElement(Objektverwalter.Symbolfunktion, "Munitionszeichen", True)
                            If DataSettings._2D_3D_Malen Then
                                Grafikengine.malen2Din3D(ObjektSpielfeld.CalcDraw2D3DVec(X, ObjektSpielfeld.SpielfeldLayer.Einheitensymbole, Y), Cube, Objektverwalter.Symbole(I), intcolor)
                            Else
                                Grafikengine.Sprite.Draw2D(Objektverwalter.Symbole(I), Grafikengine.recBild, Grafikengine.szfScale, Grafikengine.ptfRotCenter, 0, Grafikengine.ptfPosition, intcolor)
                            End If
                        End If
                    Case 3
                        If Treibstoff <= SpritMax / 3 Then
                            I = FindElement(Objektverwalter.Symbolfunktion, "Treibstoffzeichen", True)
                            If DataSettings._2D_3D_Malen Then
                                Grafikengine.malen2Din3D(ObjektSpielfeld.CalcDraw2D3DVec(X, ObjektSpielfeld.SpielfeldLayer.Einheitensymbole, Y), Cube, Objektverwalter.Symbole(I), intcolor)
                            Else
                                Grafikengine.Sprite.Draw2D(Objektverwalter.Symbole(I), Grafikengine.recBild, Grafikengine.szfScale, Grafikengine.ptfRotCenter, 0, Grafikengine.ptfPosition, intcolor)
                            End If
                        End If
                End Select
            Else
                If Besetzen = True Then
                    I = FindElement(Objektverwalter.Symbolfunktion, "Fahnenzeichen", True)
                    If DataSettings._2D_3D_Malen Then
                        Grafikengine.malen2Din3D(ObjektSpielfeld.CalcDraw2D3DVec(X, ObjektSpielfeld.SpielfeldLayer.Einheitensymbole, Y), Cube, Objektverwalter.Symbole(I), intcolor)
                    Else
                        Grafikengine.Sprite.Draw2D(Objektverwalter.Symbole(I), Grafikengine.recBild, Grafikengine.szfScale, Grafikengine.ptfRotCenter, 0, Grafikengine.ptfPosition, intcolor)
                    End If
                ElseIf Tarnung = True Or Feldtarnung = True Then
                    I = FindElement(Objektverwalter.Symbolfunktion, "Tauchzeichen", True)
                    If DataSettings._2D_3D_Malen Then
                        Grafikengine.malen2Din3D(ObjektSpielfeld.CalcDraw2D3DVec(X, ObjektSpielfeld.SpielfeldLayer.Einheitensymbole, Y), Cube, Objektverwalter.Symbole(I), intcolor)
                    Else
                        Grafikengine.Sprite.Draw2D(Objektverwalter.Symbole(I), Grafikengine.recBild, Grafikengine.szfScale, Grafikengine.ptfRotCenter, 0, Grafikengine.ptfPosition, intcolor)
                    End If
                ElseIf Munition <= MunitionMax / 3 And Frame = 2 And Munition >= 0 Then
                    If Not HasMaterial() Then
                        I = FindElement(Objektverwalter.Symbolfunktion, "Munitionszeichen", True)
                        If DataSettings._2D_3D_Malen Then
                            Grafikengine.malen2Din3D(ObjektSpielfeld.CalcDraw2D3DVec(X, ObjektSpielfeld.SpielfeldLayer.Einheitensymbole, Y), Cube, Objektverwalter.Symbole(I), intcolor)
                        Else
                            Grafikengine.Sprite.Draw2D(Objektverwalter.Symbole(I), Grafikengine.recBild, Grafikengine.szfScale, Grafikengine.ptfRotCenter, 0, Grafikengine.ptfPosition, intcolor)
                        End If
                    End If
                ElseIf Treibstoff <= SpritMax / 3 And Frame = 3 And Treibstoff >= 0 Then
                    I = FindElement(Objektverwalter.Symbolfunktion, "Treibstoffzeichen", True)
                    If DataSettings._2D_3D_Malen Then
                        Grafikengine.malen2Din3D(ObjektSpielfeld.CalcDraw2D3DVec(X, ObjektSpielfeld.SpielfeldLayer.Einheitensymbole, Y), Cube, Objektverwalter.Symbole(I), intcolor)
                    Else
                        Grafikengine.Sprite.Draw2D(Objektverwalter.Symbole(I), Grafikengine.recBild, Grafikengine.szfScale, Grafikengine.ptfRotCenter, 0, Grafikengine.ptfPosition, intcolor)
                    End If
                ElseIf Ladung.Length > 0 Then
                    If Objektverwalter.Spielfeld.Regeln.Nebel > 0 Then
                        If IsNothing(Ladung(0)) = False Then
                            I = FindElement(Objektverwalter.Symbolfunktion, "Transportzeichen", True)
                            If DataSettings._2D_3D_Malen Then
                                Grafikengine.malen2Din3D(ObjektSpielfeld.CalcDraw2D3DVec(X, ObjektSpielfeld.SpielfeldLayer.Einheitensymbole, Y), Cube, Objektverwalter.Symbole(I), intcolor)
                            Else
                                Grafikengine.Sprite.Draw2D(Objektverwalter.Symbole(I), Grafikengine.recBild, Grafikengine.szfScale, Grafikengine.ptfRotCenter, 0, Grafikengine.ptfPosition, intcolor)
                            End If
                        ElseIf Not Objektverwalter.Spielfeld.Spieler(Spieler).Team = Objektverwalter.Spielfeld.Spieler(Objektverwalter.Spielfeld.Regeln.LetzterMensch).Team Then
                            I = FindElement(Objektverwalter.Symbolfunktion, "Transportzeichenkeineahnung", True)
                            If DataSettings._2D_3D_Malen Then
                                Grafikengine.malen2Din3D(ObjektSpielfeld.CalcDraw2D3DVec(X, ObjektSpielfeld.SpielfeldLayer.Einheitensymbole, Y), Cube, Objektverwalter.Symbole(I), intcolor)
                            Else
                                Grafikengine.Sprite.Draw2D(Objektverwalter.Symbole(I), Grafikengine.recBild, Grafikengine.szfScale, Grafikengine.ptfRotCenter, 0, Grafikengine.ptfPosition, intcolor)
                            End If
                        End If
                    ElseIf Hauptmenue.Formmodus = Hauptmenue.Formmodi.Spiel Then
                        If Objektverwalter.Spielfeld.Spieler(Spieler).KOS(0).Verstecker = True And GetSpieler.KOS(0).KOBoostApply(X, Y) Then
                            If Not Objektverwalter.Spielfeld.Spieler(Spieler).Team = Objektverwalter.Spielfeld.Spieler(Objektverwalter.Spielfeld.Regeln.LetzterMensch).Team Then
                                I = FindElement(Objektverwalter.Symbolfunktion, "Transportzeichenkeineahnung", True)
                                If DataSettings._2D_3D_Malen Then
                                    Grafikengine.malen2Din3D(ObjektSpielfeld.CalcDraw2D3DVec(X, ObjektSpielfeld.SpielfeldLayer.Einheitensymbole, Y), Cube, Objektverwalter.Symbole(I), intcolor)
                                Else
                                    Grafikengine.Sprite.Draw2D(Objektverwalter.Symbole(I), Grafikengine.recBild, Grafikengine.szfScale, Grafikengine.ptfRotCenter, 0, Grafikengine.ptfPosition, intcolor)
                                End If
                            ElseIf IsNothing(Ladung(0)) = False Then
                                I = FindElement(Objektverwalter.Symbolfunktion, "Transportzeichen", True)
                                If DataSettings._2D_3D_Malen Then
                                    Grafikengine.malen2Din3D(ObjektSpielfeld.CalcDraw2D3DVec(X, ObjektSpielfeld.SpielfeldLayer.Einheitensymbole, Y), Cube, Objektverwalter.Symbole(I), intcolor)
                                Else
                                    Grafikengine.Sprite.Draw2D(Objektverwalter.Symbole(I), Grafikengine.recBild, Grafikengine.szfScale, Grafikengine.ptfRotCenter, 0, Grafikengine.ptfPosition, intcolor)
                                End If
                            End If
                        ElseIf IsNothing(Ladung(0)) = False Then
                            I = FindElement(Objektverwalter.Symbolfunktion, "Transportzeichen", True)
                            If DataSettings._2D_3D_Malen Then
                                Grafikengine.malen2Din3D(ObjektSpielfeld.CalcDraw2D3DVec(X, ObjektSpielfeld.SpielfeldLayer.Einheitensymbole, Y), Cube, Objektverwalter.Symbole(I), intcolor)
                            Else
                                Grafikengine.Sprite.Draw2D(Objektverwalter.Symbole(I), Grafikengine.recBild, Grafikengine.szfScale, Grafikengine.ptfRotCenter, 0, Grafikengine.ptfPosition, intcolor)
                            End If
                        End If
                    ElseIf IsNothing(Ladung(0)) = False Then
                        I = FindElement(Objektverwalter.Symbolfunktion, "Transportzeichen", True)
                        If DataSettings._2D_3D_Malen Then
                            Grafikengine.malen2Din3D(ObjektSpielfeld.CalcDraw2D3DVec(X, ObjektSpielfeld.SpielfeldLayer.Einheitensymbole, Y), Cube, Objektverwalter.Symbole(I), intcolor)
                        Else
                            Grafikengine.Sprite.Draw2D(Objektverwalter.Symbole(I), Grafikengine.recBild, Grafikengine.szfScale, Grafikengine.ptfRotCenter, 0, Grafikengine.ptfPosition, intcolor)
                        End If
                    End If
                End If
            End If
        End If
        If EinheitenStufe > Stufe.Soldat Then
            If getKP() = 10 Or Frame < 2 Then
                Dim I As Integer = FindElement(Objektverwalter.Symbolfunktion, EinheitenStufe.ToString, True)
                If DataSettings._2D_3D_Malen Then
                    Dim Cube(3) As CustomVertex.PositionTextured
                    Cube(0) = New CustomVertex.PositionTextured(0, 0, 0, 1, 1)
                    Cube(1) = New CustomVertex.PositionTextured(0, 0, 0.5, 1, 0)
                    Cube(2) = New CustomVertex.PositionTextured(0.5, 0, 0, 0, 1)
                    Cube(3) = New CustomVertex.PositionTextured(0.5, 0, 0.5, 0, 0)
                    Grafikengine.malen2Din3D(ObjektSpielfeld.CalcDraw2D3DVec(X + 0.5, ObjektSpielfeld.SpielfeldLayer.Einheitensymbole, Y), Cube, Objektverwalter.Symbole(I), intcolor)
                Else
                    Grafikengine.ptfRotCenter = Nothing
                    Grafikengine.recBild = Nothing
                    Grafikengine.szfScale = Nothing
                    Grafikengine.ptfPosition = New Drawing.Point(Hauptmenue.Feldbreite * X + Objektverwalter.Spielfeld.BildschirmKooX, Hauptmenue.Feldbreite * Y + Objektverwalter.Spielfeld.BildschirmKooY)
                    Grafikengine.Sprite.Draw2D(Objektverwalter.Symbole(I), Grafikengine.recBild, Grafikengine.szfScale, Grafikengine.ptfRotCenter, 0, Grafikengine.ptfPosition, intcolor)
                End If
            End If
        End If
        If TypeOf Objektverwalter.Menue Is ObjektKarteneditormenue Then
            Dim I As Integer = FindElement(Objektverwalter.Symbolfunktion, AIUse.ToString, True)
            If I >= 0 Then
                If DataSettings._2D_3D_Malen Then
                    Dim Cube(3) As CustomVertex.PositionTextured
                    Cube(0) = New CustomVertex.PositionTextured(0, 0, 0, 0, 1)
                    Cube(1) = New CustomVertex.PositionTextured(0, 0, 0.5, 0, 0)
                    Cube(2) = New CustomVertex.PositionTextured(0.5, 0, 0, 1, 1)
                    Cube(3) = New CustomVertex.PositionTextured(0.5, 0, 0.5, 1, 0)
                    Grafikengine.malen2Din3D(ObjektSpielfeld.CalcDraw2D3DVec(X, ObjektSpielfeld.SpielfeldLayer.Einheitensymbole, Y - 0.5), Cube, Objektverwalter.Symbole(I), intcolor)
                Else
                    Grafikengine.ptfPosition = New Drawing.Point(Hauptmenue.Feldbreite * X + Objektverwalter.Spielfeld.BildschirmKooX - Hauptmenue.Feldbreite / 2, Hauptmenue.Feldbreite * Y + Objektverwalter.Spielfeld.BildschirmKooY - Hauptmenue.Feldbreite / 2)
                    Grafikengine.ptfRotCenter = Nothing
                    Grafikengine.recBild = Nothing
                    Grafikengine.szfScale = Nothing
                    Grafikengine.Sprite.Draw2D(Objektverwalter.Symbole(I), Grafikengine.recBild, Grafikengine.szfScale, Grafikengine.ptfRotCenter, 0, Grafikengine.ptfPosition, intcolor)
                End If
            End If
        End If
    End Sub
    Public Shared Sub Malen(ByVal X As Integer, ByVal Y As Integer, ByVal Spieler As ObjektSpieler, ByVal Frame As Integer, ByVal ID As Integer)
        ObjektEinheit.Malen(X, Y, Spieler, Frame, ID, Spieler.Farbe)
    End Sub
    Public Shared Sub Malen(ByVal X As Integer, ByVal Y As Integer, ByVal Spieler As ObjektSpieler, ByVal Frame As Integer, ByVal ID As Integer, ByVal Farbe As Color)
        Dim sngRotation As Double = 0
        Dim intColor As Color = Color.FromArgb(255, 255, 255, 255)
        If Objektverwalter.Spielfeld IsNot Nothing Then
            If Objektverwalter.Spielfeld.GetCommanderWarsModus = CommanderWarsGameModi.FireEmblem Then
                Dim FireEmblemUnit As Fire_Emblem_MOD.FEUnit = Objektverwalter.AlleEinheiten(ID).Einheit
                With Grafikengine.recBild
                    .X = FireEmblemUnit.UnitSize.Width * Frame : .Width = FireEmblemUnit.UnitSize.Width
                    .Y = 0 : .Height = FireEmblemUnit.UnitSize.Height
                End With
                'Falls der Zoomfaktor groesser 1 ist muessen einige Raender abgeschnitten werden
                'Achtung Rotationszentrum ist auch Ausgangspunkt der bemalung
                With Grafikengine.ptfRotCenter
                    .X = FireEmblemUnit.UnitSize.Width / 2
                    .Y = FireEmblemUnit.UnitSize.Height - Hauptmenue.Feldbreite / 2
                End With
                With Grafikengine.szfScale
                    .Height = FireEmblemUnit.UnitSize.Height
                    .Width = FireEmblemUnit.UnitSize.Width
                End With
            Else
                With Grafikengine.recBild
                    .X = Hauptmenue.Feldbreite * Frame : .Width = Hauptmenue.Feldbreite
                    .Y = 0 : .Height = Hauptmenue.Feldbreite
                End With
                'Falls der Zoomfaktor groesser 1 ist muessen einige Raender abgeschnitten werden
                'Achtung Rotationszentrum ist auch Ausgangspunkt der bemalung
                With Grafikengine.ptfRotCenter
                    .X = Hauptmenue.Feldbreite / 2
                    .Y = Hauptmenue.Feldbreite / 2
                End With
                With Grafikengine.szfScale
                    .Height = Hauptmenue.Feldbreite
                    .Width = Hauptmenue.Feldbreite
                End With
            End If
        Else
            With Grafikengine.recBild
                .X = Hauptmenue.Feldbreite * Frame : .Width = Hauptmenue.Feldbreite
                .Y = 0 : .Height = Hauptmenue.Feldbreite
            End With
            'Falls der Zoomfaktor groesser 1 ist muessen einige Raender abgeschnitten werden
            'Achtung Rotationszentrum ist auch Ausgangspunkt der bemalung
            With Grafikengine.ptfRotCenter
                .X = Hauptmenue.Feldbreite / 2
                .Y = Hauptmenue.Feldbreite / 2
            End With
            With Grafikengine.szfScale
                .Height = Hauptmenue.Feldbreite
                .Width = Hauptmenue.Feldbreite
            End With
        End If
        Grafikengine.ptfPosition = New Drawing.Point(X, Y)

        'Ausschnitte in den Backbuffer zeichnen
        'Wo wird das Bild gezeichnet
        '16 ist die Breite eines Feldes 8 die Haelfte das heisst wir ermitteln den Mittelpunkt des Feldes und ziehen die Haelfte der Groesse der Einheit ab
        '... und wie breit ist es

        Dim S As String = Spieler.Armee
        If S = "" Then
            S = Armeen.OS.ToString
        End If

        Grafikengine.Sprite.Draw2D(Objektverwalter.AlleEinheiten(ID).GetEinheitentextur(S), Grafikengine.recBild, Grafikengine.szfScale, Grafikengine.ptfRotCenter, sngRotation, Grafikengine.ptfPosition, intColor)
        Grafikengine.Sprite.Draw2D(Objektverwalter.AlleEinheiten(ID).GetEinheitentexturMaske(S), Grafikengine.recBild, Grafikengine.szfScale, Grafikengine.ptfRotCenter, sngRotation, Grafikengine.ptfPosition, Farbe)

    End Sub
    Public Shared Sub Malen(ByVal Spieler As ObjektSpieler, ByVal Frame As Integer, ByVal ID As Integer, ByVal Farbe As Color)
        Dim sngRotation As Double = 0
        Dim intColor As Color = Color.FromArgb(255, 255, 255, 255)
        Dim S As String = Spieler.Armee
        If S = "" Then
            S = Armeen.OS.ToString
        End If
        Grafikengine.Sprite.Draw2D(Objektverwalter.AlleEinheiten(ID).GetEinheitentextur(S), Grafikengine.recBild, Grafikengine.szfScale, Grafikengine.ptfRotCenter, sngRotation, Grafikengine.ptfPosition, intColor)
        Grafikengine.Sprite.Draw2D(Objektverwalter.AlleEinheiten(ID).GetEinheitentexturMaske(S), Grafikengine.recBild, Grafikengine.szfScale, Grafikengine.ptfRotCenter, sngRotation, Grafikengine.ptfPosition, Farbe)

    End Sub
#End Region

    ''' <summary>
    ''' Erstellt eine unabhaengiges Klon
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function Clone() As Object Implements System.ICloneable.Clone
        Dim E As ObjektEinheit = MemberwiseClone()
        If Ladung IsNot Nothing Then
            For I = 0 To Ladung.Length - 1
                If Ladung(I) IsNot Nothing Then
                    E.Ladung(I) = Ladung(I).Clone
                End If
            Next
        Else
            ReDim E.Ladung(-1)
        End If
        ReDim E.GeladeneEinheitenIDs(-1)
        If GeladeneEinheitenIDs IsNot Nothing Then
            ReDim E.GeladeneEinheitenIDs(GeladeneEinheitenIDs.Length - 1)
            For I = 0 To GeladeneEinheitenIDs.Length - 1
                E.GeladeneEinheitenIDs(I) = GeladeneEinheitenIDs(I)
            Next
        End If
        ReDim E.EntladungsUntergrund(-1)
        If EntladungsUntergrund IsNot Nothing Then
            ReDim E.EntladungsUntergrund(EntladungsUntergrund.Length - 1)
            For I = 0 To EntladungsUntergrund.Length - 1
                E.EntladungsUntergrund(I) = EntladungsUntergrund(I)
            Next
        End If
        E.ATKDEFBoost = New Point(ATKDEFBoost.X, ATKDEFBoost.Y)
        Return E
    End Function

#Region "3D"
    ''' <summary>
    ''' 3D: setzt die Aktuelle Animation, je nach dem, ob sie sich schon bewegt hat, oder nicht.
    ''' </summary>
    ''' <remarks></remarks>
    Public Sub AnimationAktuallisieren()
        If HatsichBewegt Then
            'schon gezogen? na dann kann die Einheit ja in Ruhe faullenzen..
            If AnimSetName = AnimationSets3D.Wait.ToString Then 'Den Wait koennen wir ausnahmsweise abbrechen.
                SetAnimation(AnimationSets3D.Idle.ToString)
                Me.AnimAuszeit = -1
            Else
                SetFolgeAnimation(AnimationSets3D.Idle.ToString)
            End If
        Else
            SetFolgeAnimation(AnimationSets3D.Wait.ToString) 'warte auf Befehle
        End If
    End Sub
    ''' <summary>
    ''' 3D: Laesst die Einheit eine bestimmte Animation ausfuehren, sollange dise aktion im .X abgespeichert ist. Ansonsten wird die erste letzte Animation abgespielt. (Ind=0)
    ''' </summary>
    ''' <param name="AnimSetName"></param>
    ''' <remarks></remarks>
    Public Sub SetAnimation(ByVal AnimSetName As AnimationSets3D)
        SetAnimation(AnimSetName.ToString)
    End Sub
    ''' <summary>
    ''' 3D: Laesst die Einheit eine bestimmte Animation ausfuehren, sollange dise aktion im .X abgespeichert ist. Ansonsten wird die erste letzte Animation abgespielt. (Ind=0)
    ''' </summary>
    ''' <param name="AnimSetName"></param>
    ''' <remarks></remarks>
    Public Sub SetAnimation(ByVal AnimSetName As String)
        If Me.AnimSetName.ToLower = AnimSetName.ToLower Then Exit Sub
        If AnimController Is Nothing Then Exit Sub
        'Wenn wir neu mit der Animation beginnen, dann am besten von vorne.
        AnimPos = 0
        ' End If
        Me.AnimSetName = AnimSetName
        'Dim aSet As AnimationSet = AnimController.GetAnimationSet(AnimSetName)
        'Dim i As Integer = AnimController.NumberAnimationSets
        AnimController.SetTrackAnimationSet(0, AnimController.GetAnimationSet(Objekt3DAnim.getGueltigesAnimSet(AnimSetName, AnimController)))
        AnimController.SetTrackPosition(0, 0)

    End Sub
    ''' <summary>
    ''' 3D: Sobald die aktuelle Animation abgelaufen ist, wird eine andere Animation abgespielt. Es kann auch eine Versatzzeit mitgegeben werden.
    ''' </summary>
    ''' <param name="FolgeAnimName"></param>
    ''' <param name="Wartezeit">=0, wird direkt anschliessend abgespielt. >0 Anz Frames wartezeit. -1=wird nie ausgefuehrt!</param>
    ''' <remarks></remarks>
    Public Sub SetFolgeAnimation(ByVal FolgeAnimName As String, Optional ByVal Wartezeit As Integer = 0)
        Me.AnimSetNaechsterName = FolgeAnimName
        Me.AnimAuszeit = Wartezeit
    End Sub

    Public Function SetOrientation(ByVal Einheit As ObjektEinheit) As Single
        Return SetOrientation(Einheit.GetLocation)
    End Function
    Public Function SetOrientation(ByVal P As Point) As Single
        Rotation = GetOrientation(Me.GetLocation, P)
        Return Rotation
    End Function
    Public Function SetOrientation(ByVal P1 As Point, ByVal P2 As Point) As Single
        Rotation = GetOrientation(P1, P2)
        Return Rotation
    End Function
    Public Shared Function GetOrientation(ByVal P1 As Point, ByVal P2 As Point) As Single
        Dim DX As Integer = P1.X - P2.X
        Dim DY As Integer = P1.Y - P2.Y
        If DY = 0 Then
            If DX > 0 Then
                Return Math.PI * 3 / 2
            Else
                Return Math.PI / 2
            End If
        ElseIf DX = 0 Then
            If DY > 0 Then
                Return 0
            Else
                Return Math.PI
            End If
        Else
            Dim rot As Single = Math.Atan(-DX / DY)
            If DY < 0 Then 'If rot < Math.PI / 2 Or rot > Math.PI * 3 / 2 Then
                rot += Math.PI
            End If
            Return rot
        End If
    End Function

    Public Function GetHoehenVerschiebung() As Single
        If Tarnung Then
            Select Case EinheitenID
                Case "U-BOOT"
                    Return -0.1
                Case "TARNK"
                    Return +0.78
            End Select
        End If
        Return 0
    End Function
#End Region
End Class
